@humanspeak/svelte-markdown 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/extensions/alert/AlertRenderer.svelte +23 -0
- package/dist/extensions/alert/AlertRenderer.svelte.d.ts +8 -0
- package/dist/extensions/alert/index.d.ts +3 -0
- package/dist/extensions/alert/index.js +2 -0
- package/dist/extensions/alert/markedAlert.d.ts +37 -0
- package/dist/extensions/alert/markedAlert.js +62 -0
- package/dist/extensions/footnote/FootnoteRef.svelte +9 -0
- package/dist/extensions/footnote/FootnoteRef.svelte.d.ts +6 -0
- package/dist/extensions/footnote/FootnoteSection.svelte +25 -0
- package/dist/extensions/footnote/FootnoteSection.svelte.d.ts +10 -0
- package/dist/extensions/footnote/index.d.ts +3 -0
- package/dist/extensions/footnote/index.js +3 -0
- package/dist/extensions/footnote/markedFootnote.d.ts +31 -0
- package/dist/extensions/footnote/markedFootnote.js +80 -0
- package/dist/extensions/index.d.ts +5 -0
- package/dist/extensions/index.js +4 -0
- package/dist/renderers/Br.svelte +1 -9
- package/dist/renderers/Br.svelte.d.ts +26 -7
- package/dist/renderers/html/Sup.svelte +1 -1
- package/dist/renderers/html/Sup.svelte.d.ts +1 -1
- package/package.json +24 -23
package/README.md
CHANGED
|
@@ -485,6 +485,88 @@ You can also use snippet overrides to wrap `MermaidRenderer` with custom markup:
|
|
|
485
485
|
|
|
486
486
|
Since Mermaid rendering is async, the snippet delegates to `MermaidRenderer` rather than calling `mermaid.render()` directly. This pattern works for any async extension — keep the async logic in a component and use the snippet for layout customization.
|
|
487
487
|
|
|
488
|
+
### GitHub Alerts
|
|
489
|
+
|
|
490
|
+
Built-in support for [GitHub-style alerts/admonitions](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts). Five alert types are supported: `NOTE`, `TIP`, `IMPORTANT`, `WARNING`, and `CAUTION`.
|
|
491
|
+
|
|
492
|
+
```svelte
|
|
493
|
+
<script lang="ts">
|
|
494
|
+
import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
495
|
+
import type { RendererComponent, Renderers } from '@humanspeak/svelte-markdown'
|
|
496
|
+
import { markedAlert, AlertRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
497
|
+
|
|
498
|
+
const source = `
|
|
499
|
+
> [!NOTE]
|
|
500
|
+
> Useful information that users should know.
|
|
501
|
+
|
|
502
|
+
> [!WARNING]
|
|
503
|
+
> Urgent info that needs immediate attention.
|
|
504
|
+
`
|
|
505
|
+
|
|
506
|
+
interface AlertRenderers extends Renderers {
|
|
507
|
+
alert: RendererComponent
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const renderers: Partial<AlertRenderers> = {
|
|
511
|
+
alert: AlertRenderer
|
|
512
|
+
}
|
|
513
|
+
</script>
|
|
514
|
+
|
|
515
|
+
<SvelteMarkdown {source} extensions={[markedAlert()]} {renderers} />
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
`AlertRenderer` renders a `<div class="markdown-alert markdown-alert-{type}">` with a title — no inline styles, so you can theme it with your own CSS. You can also use snippet overrides:
|
|
519
|
+
|
|
520
|
+
```svelte
|
|
521
|
+
<SvelteMarkdown source={markdown} extensions={[markedAlert()]}>
|
|
522
|
+
{#snippet alert(props)}
|
|
523
|
+
<div class="my-alert my-alert-{props.alertType}">
|
|
524
|
+
<strong>{props.alertType}</strong>
|
|
525
|
+
<p>{props.text}</p>
|
|
526
|
+
</div>
|
|
527
|
+
{/snippet}
|
|
528
|
+
</SvelteMarkdown>
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### Footnotes
|
|
532
|
+
|
|
533
|
+
Built-in support for footnote references and definitions. Footnote references (`[^id]`) render as superscript links, and definitions (`[^id]: content`) render as a numbered list at the end of the document with back-links.
|
|
534
|
+
|
|
535
|
+
```svelte
|
|
536
|
+
<script lang="ts">
|
|
537
|
+
import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
538
|
+
import type { RendererComponent, Renderers } from '@humanspeak/svelte-markdown'
|
|
539
|
+
import {
|
|
540
|
+
markedFootnote,
|
|
541
|
+
FootnoteRef,
|
|
542
|
+
FootnoteSection
|
|
543
|
+
} from '@humanspeak/svelte-markdown/extensions'
|
|
544
|
+
|
|
545
|
+
const source = `
|
|
546
|
+
Here is a statement[^1] with a footnote.
|
|
547
|
+
|
|
548
|
+
Another claim[^note] that needs a source.
|
|
549
|
+
|
|
550
|
+
[^1]: This is the first footnote.
|
|
551
|
+
[^note]: This is a named footnote.
|
|
552
|
+
`
|
|
553
|
+
|
|
554
|
+
interface FootnoteRenderers extends Renderers {
|
|
555
|
+
footnoteRef: RendererComponent
|
|
556
|
+
footnoteSection: RendererComponent
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
const renderers: Partial<FootnoteRenderers> = {
|
|
560
|
+
footnoteRef: FootnoteRef,
|
|
561
|
+
footnoteSection: FootnoteSection
|
|
562
|
+
}
|
|
563
|
+
</script>
|
|
564
|
+
|
|
565
|
+
<SvelteMarkdown {source} extensions={[markedFootnote()]} {renderers} />
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
`FootnoteRef` renders `<sup><a href="#fn-{id}">{id}</a></sup>` and `FootnoteSection` renders an `<ol>` with bidirectional links (ref to definition and back). You can also use snippet overrides for custom rendering.
|
|
569
|
+
|
|
488
570
|
### How It Works
|
|
489
571
|
|
|
490
572
|
Marked extensions define custom token types with a `name` property (e.g., `inlineKatex`, `blockKatex`, `alert`). When you pass extensions via the `extensions` prop, SvelteMarkdown automatically extracts these token type names and makes them available as both **component renderer keys** and **snippet override names**.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AlertType } from './markedAlert.js'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
text: string
|
|
6
|
+
alertType: AlertType
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { text, alertType }: Props = $props()
|
|
10
|
+
|
|
11
|
+
const titles: Record<AlertType, string> = {
|
|
12
|
+
note: 'Note',
|
|
13
|
+
tip: 'Tip',
|
|
14
|
+
important: 'Important',
|
|
15
|
+
warning: 'Warning',
|
|
16
|
+
caution: 'Caution'
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="markdown-alert markdown-alert-{alertType}" role="note">
|
|
21
|
+
<p class="markdown-alert-title">{titles[alertType]}</p>
|
|
22
|
+
<p>{text}</p>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AlertType } from './markedAlert.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
text: string;
|
|
4
|
+
alertType: AlertType;
|
|
5
|
+
}
|
|
6
|
+
declare const AlertRenderer: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type AlertRenderer = ReturnType<typeof AlertRenderer>;
|
|
8
|
+
export default AlertRenderer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { MarkedExtension } from 'marked';
|
|
2
|
+
/**
|
|
3
|
+
* Valid GitHub-style alert types.
|
|
4
|
+
*
|
|
5
|
+
* @see https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
|
|
6
|
+
*/
|
|
7
|
+
export type AlertType = 'note' | 'tip' | 'important' | 'warning' | 'caution';
|
|
8
|
+
/**
|
|
9
|
+
* Creates a marked extension that tokenizes GitHub-style alert blockquotes
|
|
10
|
+
* into custom `alert` tokens.
|
|
11
|
+
*
|
|
12
|
+
* The extension produces block-level tokens with
|
|
13
|
+
* `{ type: 'alert', raw, text, alertType }` where `alertType` is one of
|
|
14
|
+
* `note`, `tip`, `important`, `warning`, or `caution`, and `text` is the
|
|
15
|
+
* alert body with leading `> ` stripped.
|
|
16
|
+
*
|
|
17
|
+
* Pair it with `AlertRenderer` (or your own component) to render the alerts.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```svelte
|
|
21
|
+
* <script lang="ts">
|
|
22
|
+
* import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
23
|
+
* import { markedAlert, AlertRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
24
|
+
*
|
|
25
|
+
* const renderers = { alert: AlertRenderer }
|
|
26
|
+
* </script>
|
|
27
|
+
*
|
|
28
|
+
* <SvelteMarkdown
|
|
29
|
+
* source={markdown}
|
|
30
|
+
* extensions={[markedAlert()]}
|
|
31
|
+
* {renderers}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @returns A `MarkedExtension` with a single block-level `alert` tokenizer
|
|
36
|
+
*/
|
|
37
|
+
export declare function markedAlert(): MarkedExtension;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const ALERT_TYPES = new Set(['note', 'tip', 'important', 'warning', 'caution']);
|
|
2
|
+
/**
|
|
3
|
+
* Creates a marked extension that tokenizes GitHub-style alert blockquotes
|
|
4
|
+
* into custom `alert` tokens.
|
|
5
|
+
*
|
|
6
|
+
* The extension produces block-level tokens with
|
|
7
|
+
* `{ type: 'alert', raw, text, alertType }` where `alertType` is one of
|
|
8
|
+
* `note`, `tip`, `important`, `warning`, or `caution`, and `text` is the
|
|
9
|
+
* alert body with leading `> ` stripped.
|
|
10
|
+
*
|
|
11
|
+
* Pair it with `AlertRenderer` (or your own component) to render the alerts.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```svelte
|
|
15
|
+
* <script lang="ts">
|
|
16
|
+
* import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
17
|
+
* import { markedAlert, AlertRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
18
|
+
*
|
|
19
|
+
* const renderers = { alert: AlertRenderer }
|
|
20
|
+
* </script>
|
|
21
|
+
*
|
|
22
|
+
* <SvelteMarkdown
|
|
23
|
+
* source={markdown}
|
|
24
|
+
* extensions={[markedAlert()]}
|
|
25
|
+
* {renderers}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns A `MarkedExtension` with a single block-level `alert` tokenizer
|
|
30
|
+
*/
|
|
31
|
+
export function markedAlert() {
|
|
32
|
+
return {
|
|
33
|
+
extensions: [
|
|
34
|
+
{
|
|
35
|
+
name: 'alert',
|
|
36
|
+
level: 'block',
|
|
37
|
+
start(src) {
|
|
38
|
+
return src.match(/>\s*\[!/)?.index;
|
|
39
|
+
},
|
|
40
|
+
tokenizer(src) {
|
|
41
|
+
const match = src.match(/^(?:>\s*\[!(\w+)\]\n)((?:[^\n]*(?:\n(?:>\s?)[^\n]*)*)?)(?:\n|$)/);
|
|
42
|
+
if (match) {
|
|
43
|
+
const alertType = match[1].toLowerCase();
|
|
44
|
+
if (!ALERT_TYPES.has(alertType))
|
|
45
|
+
return;
|
|
46
|
+
const text = match[2]
|
|
47
|
+
.split('\n')
|
|
48
|
+
.map((line) => line.replace(/^>\s?/, ''))
|
|
49
|
+
.join('\n')
|
|
50
|
+
.trim();
|
|
51
|
+
return {
|
|
52
|
+
type: 'alert',
|
|
53
|
+
raw: match[0],
|
|
54
|
+
text,
|
|
55
|
+
alertType: alertType
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Footnote {
|
|
3
|
+
id: string
|
|
4
|
+
text: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
footnotes: Footnote[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { footnotes }: Props = $props()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<section class="footnotes" role="doc-endnotes">
|
|
15
|
+
<ol>
|
|
16
|
+
{#each footnotes as { id, text } (id)}
|
|
17
|
+
<li id="fn-{id}">
|
|
18
|
+
<p>
|
|
19
|
+
{text}
|
|
20
|
+
<a href="#fnref-{id}" class="footnote-backref" role="doc-backlink">↩</a>
|
|
21
|
+
</p>
|
|
22
|
+
</li>
|
|
23
|
+
{/each}
|
|
24
|
+
</ol>
|
|
25
|
+
</section>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Footnote {
|
|
2
|
+
id: string;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
interface Props {
|
|
6
|
+
footnotes: Footnote[];
|
|
7
|
+
}
|
|
8
|
+
declare const FootnoteSection: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type FootnoteSection = ReturnType<typeof FootnoteSection>;
|
|
10
|
+
export default FootnoteSection;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MarkedExtension } from 'marked';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a marked extension that tokenizes footnote references (`[^id]`) and
|
|
4
|
+
* footnote definitions (`[^id]: content`) into custom tokens.
|
|
5
|
+
*
|
|
6
|
+
* The extension produces:
|
|
7
|
+
* - **Inline** `footnoteRef` tokens: `{ type: 'footnoteRef', raw, id }`
|
|
8
|
+
* - **Block** `footnoteSection` tokens: `{ type: 'footnoteSection', raw, footnotes }` where
|
|
9
|
+
* `footnotes` is an array of `{ id, text }` objects
|
|
10
|
+
*
|
|
11
|
+
* Pair with `FootnoteRef` and `FootnoteSection` components (or your own) for rendering.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```svelte
|
|
15
|
+
* <script lang="ts">
|
|
16
|
+
* import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
17
|
+
* import { markedFootnote, FootnoteRef, FootnoteSection } from '@humanspeak/svelte-markdown/extensions'
|
|
18
|
+
*
|
|
19
|
+
* const renderers = { footnoteRef: FootnoteRef, footnoteSection: FootnoteSection }
|
|
20
|
+
* </script>
|
|
21
|
+
*
|
|
22
|
+
* <SvelteMarkdown
|
|
23
|
+
* source={markdown}
|
|
24
|
+
* extensions={[markedFootnote()]}
|
|
25
|
+
* {renderers}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns A `MarkedExtension` with inline `footnoteRef` and block `footnoteSection` tokenizers
|
|
30
|
+
*/
|
|
31
|
+
export declare function markedFootnote(): MarkedExtension;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a marked extension that tokenizes footnote references (`[^id]`) and
|
|
3
|
+
* footnote definitions (`[^id]: content`) into custom tokens.
|
|
4
|
+
*
|
|
5
|
+
* The extension produces:
|
|
6
|
+
* - **Inline** `footnoteRef` tokens: `{ type: 'footnoteRef', raw, id }`
|
|
7
|
+
* - **Block** `footnoteSection` tokens: `{ type: 'footnoteSection', raw, footnotes }` where
|
|
8
|
+
* `footnotes` is an array of `{ id, text }` objects
|
|
9
|
+
*
|
|
10
|
+
* Pair with `FootnoteRef` and `FootnoteSection` components (or your own) for rendering.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```svelte
|
|
14
|
+
* <script lang="ts">
|
|
15
|
+
* import SvelteMarkdown from '@humanspeak/svelte-markdown'
|
|
16
|
+
* import { markedFootnote, FootnoteRef, FootnoteSection } from '@humanspeak/svelte-markdown/extensions'
|
|
17
|
+
*
|
|
18
|
+
* const renderers = { footnoteRef: FootnoteRef, footnoteSection: FootnoteSection }
|
|
19
|
+
* </script>
|
|
20
|
+
*
|
|
21
|
+
* <SvelteMarkdown
|
|
22
|
+
* source={markdown}
|
|
23
|
+
* extensions={[markedFootnote()]}
|
|
24
|
+
* {renderers}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @returns A `MarkedExtension` with inline `footnoteRef` and block `footnoteSection` tokenizers
|
|
29
|
+
*/
|
|
30
|
+
export function markedFootnote() {
|
|
31
|
+
return {
|
|
32
|
+
extensions: [
|
|
33
|
+
{
|
|
34
|
+
name: 'footnoteRef',
|
|
35
|
+
level: 'inline',
|
|
36
|
+
start(src) {
|
|
37
|
+
return src.match(/\[\^/)?.index;
|
|
38
|
+
},
|
|
39
|
+
tokenizer(src) {
|
|
40
|
+
const match = src.match(/^\[\^([^\]\s]+)\](?!:)/);
|
|
41
|
+
if (match) {
|
|
42
|
+
return {
|
|
43
|
+
type: 'footnoteRef',
|
|
44
|
+
raw: match[0],
|
|
45
|
+
id: match[1]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'footnoteSection',
|
|
52
|
+
level: 'block',
|
|
53
|
+
start(src) {
|
|
54
|
+
return src.match(/\[\^[^\]\s]+\]:/)?.index;
|
|
55
|
+
},
|
|
56
|
+
tokenizer(src) {
|
|
57
|
+
const match = src.match(/^(?:\[\^([^\]\s]+)\]:\s*([^\n]*(?:\n(?!\[\^)[^\n]*)*)(?:\n|$))+/);
|
|
58
|
+
if (match) {
|
|
59
|
+
const footnotes = [];
|
|
60
|
+
const defRegex = /\[\^([^\]\s]+)\]:\s*([^\n]*(?:\n(?!\[\^|\n)[^\n]*)*)/g;
|
|
61
|
+
let defMatch;
|
|
62
|
+
while ((defMatch = defRegex.exec(match[0])) !== null) {
|
|
63
|
+
footnotes.push({
|
|
64
|
+
id: defMatch[1],
|
|
65
|
+
text: defMatch[2].trim()
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (footnotes.length > 0) {
|
|
69
|
+
return {
|
|
70
|
+
type: 'footnoteSection',
|
|
71
|
+
raw: match[0],
|
|
72
|
+
footnotes
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
7
|
* import { markedMermaid, MermaidRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
8
|
+
* import { markedAlert, AlertRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
9
|
+
* import { markedFootnote, FootnoteRef, FootnoteSection } from '@humanspeak/svelte-markdown/extensions'
|
|
8
10
|
* ```
|
|
9
11
|
*
|
|
10
12
|
* @module @humanspeak/svelte-markdown/extensions
|
|
11
13
|
*/
|
|
14
|
+
export { AlertRenderer, markedAlert } from './alert/index.js';
|
|
15
|
+
export type { AlertType } from './alert/index.js';
|
|
16
|
+
export { FootnoteRef, FootnoteSection, markedFootnote } from './footnote/index.js';
|
|
12
17
|
export { MermaidRenderer, markedMermaid } from './mermaid/index.js';
|
package/dist/extensions/index.js
CHANGED
|
@@ -5,8 +5,12 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
7
|
* import { markedMermaid, MermaidRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
8
|
+
* import { markedAlert, AlertRenderer } from '@humanspeak/svelte-markdown/extensions'
|
|
9
|
+
* import { markedFootnote, FootnoteRef, FootnoteSection } from '@humanspeak/svelte-markdown/extensions'
|
|
8
10
|
* ```
|
|
9
11
|
*
|
|
10
12
|
* @module @humanspeak/svelte-markdown/extensions
|
|
11
13
|
*/
|
|
14
|
+
export { AlertRenderer, markedAlert } from './alert/index.js';
|
|
15
|
+
export { FootnoteRef, FootnoteSection, markedFootnote } from './footnote/index.js';
|
|
12
16
|
export { MermaidRenderer, markedMermaid } from './mermaid/index.js';
|
package/dist/renderers/Br.svelte
CHANGED
|
@@ -2,13 +2,5 @@
|
|
|
2
2
|
@component
|
|
3
3
|
Renders a markdown line break as a `<br />` element.
|
|
4
4
|
-->
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import type { Snippet } from 'svelte'
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
children?: Snippet
|
|
10
|
-
}
|
|
11
|
-
const { children }: Props = $props()
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<br />{@render children?.()}
|
|
6
|
+
<br />
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
interface Props {
|
|
3
|
-
children?: Snippet;
|
|
4
|
-
}
|
|
5
|
-
/** Renders a markdown line break as a `<br />` element. */
|
|
6
|
-
declare const Br: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type Br = ReturnType<typeof Br>;
|
|
8
1
|
export default Br;
|
|
2
|
+
type Br = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
/** Renders a markdown line break as a `<br />` element. */
|
|
10
|
+
declare const Br: $$__sveltets_2_IsomorphicComponent<{
|
|
11
|
+
[x: string]: never;
|
|
12
|
+
}, {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
}, {}, {}, string>;
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -7,7 +7,7 @@ Renders an HTML `<sup>` element. Accepts optional attributes and child content.
|
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
children?: Snippet
|
|
10
|
-
attributes?: Record<string,
|
|
10
|
+
attributes?: Record<string, any> // trunk-ignore(eslint/@typescript-eslint/no-explicit-any)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const { children, attributes }: Props = $props()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
interface Props {
|
|
3
3
|
children?: Snippet;
|
|
4
|
-
attributes?: Record<string,
|
|
4
|
+
attributes?: Record<string, any>;
|
|
5
5
|
}
|
|
6
6
|
/** Renders an HTML `<sup>` element. Accepts optional attributes and child content. */
|
|
7
7
|
declare const Sup: import("svelte").Component<Props, {}, "">;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humanspeak/svelte-markdown",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Fast, customizable markdown renderer for Svelte with built-in caching, TypeScript support, and Svelte 5 runes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -67,51 +67,51 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@humanspeak/memory-cache": "^1.0.
|
|
70
|
+
"@humanspeak/memory-cache": "^1.0.6",
|
|
71
71
|
"github-slugger": "^2.0.0",
|
|
72
72
|
"htmlparser2": "^10.1.0",
|
|
73
|
-
"marked": "^17.0.
|
|
73
|
+
"marked": "^17.0.4"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@eslint/compat": "^2.0.
|
|
76
|
+
"@eslint/compat": "^2.0.3",
|
|
77
77
|
"@eslint/js": "^10.0.1",
|
|
78
78
|
"@playwright/cli": "^0.1.1",
|
|
79
79
|
"@playwright/test": "^1.58.2",
|
|
80
80
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
81
|
-
"@sveltejs/kit": "^2.
|
|
81
|
+
"@sveltejs/kit": "^2.55.0",
|
|
82
82
|
"@sveltejs/package": "^2.5.7",
|
|
83
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
83
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
84
84
|
"@testing-library/jest-dom": "^6.9.1",
|
|
85
85
|
"@testing-library/svelte": "^5.3.1",
|
|
86
86
|
"@testing-library/user-event": "^14.6.1",
|
|
87
87
|
"@types/katex": "^0.16.8",
|
|
88
|
-
"@types/node": "^25.
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
90
|
-
"@typescript-eslint/parser": "^8.
|
|
91
|
-
"@vitest/coverage-v8": "^4.0
|
|
92
|
-
"eslint": "^10.0.
|
|
88
|
+
"@types/node": "^25.5.0",
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
90
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
91
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
92
|
+
"eslint": "^10.0.3",
|
|
93
93
|
"eslint-config-prettier": "^10.1.8",
|
|
94
94
|
"eslint-plugin-import": "^2.32.0",
|
|
95
|
-
"eslint-plugin-svelte": "^3.15.
|
|
95
|
+
"eslint-plugin-svelte": "^3.15.2",
|
|
96
96
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
97
|
-
"globals": "^17.
|
|
97
|
+
"globals": "^17.4.0",
|
|
98
98
|
"husky": "^9.1.7",
|
|
99
99
|
"jsdom": "^28.1.0",
|
|
100
|
-
"katex": "^0.16.
|
|
100
|
+
"katex": "^0.16.38",
|
|
101
101
|
"marked-katex-extension": "^5.1.7",
|
|
102
|
-
"mermaid": "^11.
|
|
102
|
+
"mermaid": "^11.13.0",
|
|
103
103
|
"mprocs": "^0.8.3",
|
|
104
104
|
"prettier": "^3.8.1",
|
|
105
105
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
106
|
-
"prettier-plugin-svelte": "^3.5.
|
|
106
|
+
"prettier-plugin-svelte": "^3.5.1",
|
|
107
107
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
108
|
-
"publint": "^0.3.
|
|
109
|
-
"svelte": "^5.53.
|
|
110
|
-
"svelte-check": "^4.4.
|
|
108
|
+
"publint": "^0.3.18",
|
|
109
|
+
"svelte": "^5.53.11",
|
|
110
|
+
"svelte-check": "^4.4.5",
|
|
111
111
|
"typescript": "^5.9.3",
|
|
112
|
-
"typescript-eslint": "^8.
|
|
113
|
-
"vite": "^
|
|
114
|
-
"vitest": "^4.0
|
|
112
|
+
"typescript-eslint": "^8.57.0",
|
|
113
|
+
"vite": "^8.0.0",
|
|
114
|
+
"vitest": "^4.1.0"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"mermaid": ">=10.0.0",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
"volta": {
|
|
126
|
-
"node": "
|
|
126
|
+
"node": "24.14.0"
|
|
127
127
|
},
|
|
128
128
|
"publishConfig": {
|
|
129
129
|
"access": "public"
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
],
|
|
135
135
|
"scripts": {
|
|
136
136
|
"build": "vite build && npm run package",
|
|
137
|
+
"cf-typegen": "pnpm --filter docs cf-typegen",
|
|
137
138
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
138
139
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
139
140
|
"dev": "vite dev",
|