Skip to content

Commit

Permalink
Merge pull request #1228 from ItzNotABug/fix-sections-numberings
Browse files Browse the repository at this point in the history
Fix sections numberings
  • Loading branch information
TorstenDittmann authored Dec 13, 2024
2 parents f1c029b + fa0df07 commit 579a714
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/lib/layouts/DocsArticle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
</script>

<script lang="ts">
import { scrollToTop } from '$lib/actions/scrollToTop';
import { setContext } from 'svelte';
import { writable } from 'svelte/store';
import { Feedback } from '$lib/components';
import { scrollToTop } from '$lib/actions/scrollToTop';
export let title: string;
export let toc: Array<TocItem>;
export let back: string | undefined = undefined;
export let date: string | undefined = undefined;
const reducedArticleSize = setContext('articleHasNumericBadge', writable(false));
</script>

<main class="contents" id="main">
Expand Down Expand Up @@ -59,8 +62,9 @@
</div>
<div class="web-article-header-end" />
</header>
<div class="web-article-content">
<div class="web-article-content" class:web-reduced-article-size={$reducedArticleSize}>
<slot />

<Feedback {date} />
</div>
<aside class="web-references-menu ps-6">
Expand Down Expand Up @@ -110,3 +114,12 @@
</aside>
</article>
</main>

<style>
@media (min-width: 1280px) and (max-width: 1330px) {
.web-reduced-article-size {
/* original/default is 41.5rem */
max-inline-size: 40.5rem;
}
}
</style>
6 changes: 6 additions & 0 deletions src/markdoc/tags/Section.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<script lang="ts">
import { type Writable } from 'svelte/store';
import Heading from '../nodes/Heading.svelte';
import { getContext, hasContext } from 'svelte';
export let id: string;
export let step: number;
export let title: string;
if (hasContext('articleHasNumericBadge')) {
getContext<Writable<boolean>>('articleHasNumericBadge').set(true);
}
</script>

<section class="web-article-content-section is-with-line">
Expand Down

0 comments on commit 579a714

Please sign in to comment.