Skip to content

Commit 16c2a63

Browse files
committed
Build
1 parent b0ddd1a commit 16c2a63

38 files changed

+221
-39
lines changed

dist/components/blockquote/blockquote.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
</script>
88

99
<blockquote>
10-
{#each children as child}<Node node={child} />{/each}
10+
{#each children as child (child)}<Node node={child} />{/each}
1111
</blockquote>

dist/components/break/break.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
23
let { node }: { node: import('mdast').Break } = $props();
34
</script>
45

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<script lang="ts">
2+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
23
let { node }: { node: import('mdast').Definition } = $props();
34
</script>

dist/components/delete/delete.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
</script>
88

99
<del
10-
>{#each children as child}<Node node={child} />{/each}</del
10+
>{#each children as child (child)}<Node node={child} />{/each}</del
1111
>

dist/components/emphasis/emphasis.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
</script>
88

99
<em
10-
>{#each children as child}<Node node={child} />{/each}</em
10+
>{#each children as child (child)}<Node node={child} />{/each}</em
1111
>
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<script lang="ts">
2+
import { sanitizeId } from '../../utils/index.js';
23
import { Node } from '@typematter/svelte-unist';
34
45
let { node }: { node: import('mdast').FootnoteDefinition } = $props();
56
67
let { children, identifier, label } = $derived(node);
8+
9+
let id = $derived(sanitizeId(identifier));
710
</script>
811

9-
<div id="footnote-{identifier}">
12+
<div id="footnote-{id}">
1013
<p>{label}.</p>
11-
{#each children as child}<Node node={child} />{/each}
12-
<a href="#footnote-ref-{identifier}" aria-label="Back to content">&hookleftarrow;</a>
14+
{#each children as child (child)}<Node node={child} />{/each}
15+
<a href="#footnote-ref-{id}" aria-label="Back to content">&hookleftarrow;</a>
1316
</div>

dist/components/footnote-definition/footnote-definition.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@ describe('FootnoteDefinition', () => {
2828
});
2929
it('renders <div> with `id` attribute', ({ props }) => {
3030
mount(Unist, { props, target: document.body });
31-
expect(document.body.querySelector('div#footnote-1')).toBeInTheDocument();
31+
expect(document.body.querySelector('div#footnote-id-1')).toBeInTheDocument();
3232
});
3333
it('renders <p> in <div>', ({ props }) => {
3434
mount(Unist, { props, target: document.body });
35-
expect(document.body.querySelector('div#footnote-1 > p')).toBeInTheDocument();
35+
expect(document.body.querySelector('div#footnote-id-1 > p')).toBeInTheDocument();
3636
});
3737
it('renders <p> in <div> with `label` content', ({ props }) => {
3838
mount(Unist, { props, target: document.body });
39-
expect(document.body.querySelector('div#footnote-1 > p')).toHaveTextContent('1');
39+
expect(document.body.querySelector('div#footnote-id-1 > p')).toHaveTextContent('1');
4040
});
4141
it('renders <a> in <div>', ({ props }) => {
4242
mount(Unist, { props, target: document.body });
43-
expect(document.body.querySelector('div#footnote-1 > a')).toBeInTheDocument();
43+
expect(document.body.querySelector('div#footnote-id-1 > a')).toBeInTheDocument();
4444
});
4545
it('renders <a> in <div> with `href` attribute', ({ props }) => {
4646
mount(Unist, { props, target: document.body });
47-
expect(document.body.querySelector('div#footnote-1 > a')).toHaveAttribute('href', '#footnote-ref-1');
47+
expect(document.body.querySelector('div#footnote-id-1 > a')).toHaveAttribute('href', '#footnote-ref-id-1');
4848
});
4949
it('renders <a> in <div> with `aria-label', ({ props }) => {
5050
mount(Unist, { props, target: document.body });
51-
expect(document.body.querySelector('div#footnote-1 > a')).toHaveAttribute('aria-label', 'Back to content');
51+
expect(document.body.querySelector('div#footnote-id-1 > a')).toHaveAttribute('aria-label', 'Back to content');
5252
});
5353
it('renders <a> in <div> with content', ({ props }) => {
5454
mount(Unist, { props, target: document.body });
55-
expect(document.body.querySelector('div#footnote-1 a')).toHaveTextContent('↩');
55+
expect(document.body.querySelector('div#footnote-id-1 a')).toHaveTextContent('↩');
5656
});
5757
});
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script lang="ts">
2+
import { sanitizeId } from '../../utils/index.js';
3+
24
let { node }: { node: import('mdast').FootnoteReference } = $props();
35
46
let { identifier, label } = $derived(node);
7+
8+
let id = $derived(sanitizeId(identifier));
59
</script>
610

711
<sup
8-
><a id="footnote-ref-{identifier}" href="#footnote-{identifier}" aria-describedby="footnote-label"
9-
>{label}</a
12+
><a id="footnote-ref-{id}" href="#footnote-{id}" aria-describedby="footnote-label">{label}</a
1013
></sup
1114
>

dist/components/heading/heading.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
</script>
1010

1111
<svelte:element this={tag}
12-
>{#each children as child}<Node node={child} />{/each}</svelte:element
12+
>{#each children as child (child)}<Node node={child} />{/each}</svelte:element
1313
>

dist/components/heading/heading.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Heading', () => {
1212
props: {
1313
ast: u('heading', { depth }, [u('text', { value: 'Hello, World!' })]),
1414
components: { heading: Heading }
15-
},
15+
}
1616
});
1717
it(`renders <h${depth}>`, ({ props }) => {
1818
mount(Unist, { props, target: document.body });

0 commit comments

Comments
 (0)