@humanspeak/svelte-markdown 0.6.1 → 0.7.0

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.
Files changed (111) hide show
  1. package/README.md +63 -53
  2. package/dist/Parser.svelte +12 -7
  3. package/dist/SvelteMarkdown.svelte +34 -8
  4. package/dist/SvelteMarkdown.svelte.d.ts +27 -7
  5. package/dist/renderers/Blockquote.svelte.d.ts +3 -3
  6. package/dist/renderers/Br.svelte.d.ts +3 -3
  7. package/dist/renderers/Code.svelte.d.ts +2 -2
  8. package/dist/renderers/Codespan.svelte.d.ts +2 -2
  9. package/dist/renderers/Del.svelte.d.ts +3 -3
  10. package/dist/renderers/Em.svelte.d.ts +3 -3
  11. package/dist/renderers/Heading.svelte.d.ts +4 -4
  12. package/dist/renderers/Image.svelte.d.ts +2 -2
  13. package/dist/renderers/Link.svelte.d.ts +3 -3
  14. package/dist/renderers/List.svelte.d.ts +3 -3
  15. package/dist/renderers/ListItem.svelte.d.ts +3 -3
  16. package/dist/renderers/Paragraph.svelte.d.ts +3 -3
  17. package/dist/renderers/Strong.svelte.d.ts +3 -3
  18. package/dist/renderers/Table.svelte.d.ts +3 -3
  19. package/dist/renderers/TableBody.svelte.d.ts +3 -3
  20. package/dist/renderers/TableCell.svelte.d.ts +3 -3
  21. package/dist/renderers/TableHead.svelte.d.ts +3 -3
  22. package/dist/renderers/TableRow.svelte.d.ts +3 -3
  23. package/dist/renderers/Text.svelte.d.ts +3 -3
  24. package/dist/renderers/html/A.svelte +1 -1
  25. package/dist/renderers/html/Abbr.svelte +1 -1
  26. package/dist/renderers/html/Address.svelte +1 -1
  27. package/dist/renderers/html/Article.svelte +1 -1
  28. package/dist/renderers/html/Aside.svelte +1 -1
  29. package/dist/renderers/html/Audio.svelte +1 -1
  30. package/dist/renderers/html/B.svelte +1 -1
  31. package/dist/renderers/html/Bdi.svelte +1 -1
  32. package/dist/renderers/html/Bdo.svelte +1 -1
  33. package/dist/renderers/html/Blockquote.svelte +1 -1
  34. package/dist/renderers/html/Button.svelte +1 -1
  35. package/dist/renderers/html/Canvas.svelte +1 -1
  36. package/dist/renderers/html/Cite.svelte +1 -1
  37. package/dist/renderers/html/Code.svelte +1 -1
  38. package/dist/renderers/html/Datalist.svelte +1 -1
  39. package/dist/renderers/html/Dd.svelte +1 -1
  40. package/dist/renderers/html/Del.svelte +1 -1
  41. package/dist/renderers/html/Details.svelte +1 -1
  42. package/dist/renderers/html/Dfn.svelte +1 -1
  43. package/dist/renderers/html/Dialog.svelte +1 -1
  44. package/dist/renderers/html/Div.svelte +1 -1
  45. package/dist/renderers/html/Dl.svelte +1 -1
  46. package/dist/renderers/html/Dt.svelte +1 -1
  47. package/dist/renderers/html/Em.svelte +1 -1
  48. package/dist/renderers/html/Embed.svelte +1 -1
  49. package/dist/renderers/html/Fieldset.svelte +1 -1
  50. package/dist/renderers/html/Footer.svelte +1 -1
  51. package/dist/renderers/html/Form.svelte +1 -1
  52. package/dist/renderers/html/H1.svelte +1 -1
  53. package/dist/renderers/html/H2.svelte +1 -1
  54. package/dist/renderers/html/H3.svelte +1 -1
  55. package/dist/renderers/html/H4.svelte +1 -1
  56. package/dist/renderers/html/H5.svelte +1 -1
  57. package/dist/renderers/html/H6.svelte +1 -1
  58. package/dist/renderers/html/Header.svelte +1 -1
  59. package/dist/renderers/html/Hgroup.svelte +1 -1
  60. package/dist/renderers/html/Hr.svelte +1 -3
  61. package/dist/renderers/html/I.svelte +1 -1
  62. package/dist/renderers/html/Iframe.svelte +1 -1
  63. package/dist/renderers/html/Img.svelte +1 -3
  64. package/dist/renderers/html/Input.svelte +1 -1
  65. package/dist/renderers/html/Kbd.svelte +1 -1
  66. package/dist/renderers/html/Label.svelte +1 -1
  67. package/dist/renderers/html/Legend.svelte +1 -1
  68. package/dist/renderers/html/Li.svelte +1 -1
  69. package/dist/renderers/html/Main.svelte +1 -1
  70. package/dist/renderers/html/Mark.svelte +1 -1
  71. package/dist/renderers/html/Menu.svelte +1 -1
  72. package/dist/renderers/html/Meter.svelte +1 -1
  73. package/dist/renderers/html/Nav.svelte +1 -1
  74. package/dist/renderers/html/Ol.svelte +1 -1
  75. package/dist/renderers/html/Optgroup.svelte +1 -1
  76. package/dist/renderers/html/Option.svelte +1 -1
  77. package/dist/renderers/html/Output.svelte +1 -1
  78. package/dist/renderers/html/P.svelte +1 -1
  79. package/dist/renderers/html/Param.svelte +1 -1
  80. package/dist/renderers/html/Picture.svelte +1 -1
  81. package/dist/renderers/html/Pre.svelte +1 -1
  82. package/dist/renderers/html/Progress.svelte +1 -1
  83. package/dist/renderers/html/S.svelte +1 -1
  84. package/dist/renderers/html/Samp.svelte +1 -1
  85. package/dist/renderers/html/Section.svelte +1 -1
  86. package/dist/renderers/html/Select.svelte +1 -1
  87. package/dist/renderers/html/Small.svelte +1 -1
  88. package/dist/renderers/html/Source.svelte +1 -1
  89. package/dist/renderers/html/Span.svelte +1 -1
  90. package/dist/renderers/html/Strong.svelte +1 -1
  91. package/dist/renderers/html/Sub.svelte +1 -1
  92. package/dist/renderers/html/Summary.svelte +1 -1
  93. package/dist/renderers/html/Table.svelte +1 -1
  94. package/dist/renderers/html/Tbody.svelte +1 -1
  95. package/dist/renderers/html/Td.svelte +1 -1
  96. package/dist/renderers/html/Textarea.svelte +1 -3
  97. package/dist/renderers/html/Tfoot.svelte +1 -1
  98. package/dist/renderers/html/Th.svelte +1 -1
  99. package/dist/renderers/html/Thead.svelte +1 -1
  100. package/dist/renderers/html/Tr.svelte +1 -1
  101. package/dist/renderers/html/Track.svelte +1 -1
  102. package/dist/renderers/html/U.svelte +1 -1
  103. package/dist/renderers/html/Ul.svelte +1 -1
  104. package/dist/renderers/html/Var.svelte +1 -1
  105. package/dist/renderers/html/index.js +0 -2
  106. package/dist/utils/markdown-parser.d.ts +28 -3
  107. package/dist/utils/token-cleanup.d.ts +11 -0
  108. package/dist/utils/token-cleanup.js +90 -15
  109. package/package.json +27 -24
  110. package/dist/renderers/html/Object.svelte +0 -12
  111. package/dist/renderers/html/Object.svelte.d.ts +0 -7
package/README.md CHANGED
@@ -1,7 +1,23 @@
1
1
  # Svelte Markdown
2
2
 
3
+ [![NPM version](https://img.shields.io/npm/v/@humanspeak/svelte-markdown.svg)](https://www.npmjs.com/package/@humanspeak/svelte-markdown)
4
+ [![Build Status](https://github.com/humanspeak/svelte-markdown/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/humanspeak/svelte-markdown/actions/workflows/npm-publish.yml)
5
+ [![Coverage Status](https://coveralls.io/repos/github/humanspeak/svelte-markdown/badge.svg?branch=main)](https://coveralls.io/github/humanspeak/svelte-markdown?branch=main)
6
+ [![License](https://img.shields.io/npm/l/@humanspeak/svelte-markdown.svg)](https://github.com/humanspeak/svelte-markdown/blob/main/LICENSE)
7
+ <!-- [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@humanspeak/svelte-markdown)](https://bundlephobia.com/package/@humanspeak/svelte-markdown) -->
8
+ [![Downloads](https://img.shields.io/npm/dm/@humanspeak/svelte-markdown.svg)](https://www.npmjs.com/package/@humanspeak/svelte-markdown)
9
+ [![CodeQL](https://github.com/humanspeak/svelte-markdown/actions/workflows/codeql.yml/badge.svg)](https://github.com/humanspeak/svelte-markdown/actions/workflows/codeql.yml)
10
+ <!-- [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) -->
11
+ [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
12
+ [![Types](https://img.shields.io/npm/types/@humanspeak/svelte-markdown.svg)](https://www.npmjs.com/package/@humanspeak/svelte-markdown)
13
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/humanspeak/svelte-markdown/graphs/commit-activity)
14
+
3
15
  A markdown parser that renders into Svelte Components. Inspired by [ReactMarkdown](https://github.com/remarkjs/react-markdown).
4
16
 
17
+ Feel free to play with it and leave comments on its [homepage](https://markdown.svelte.page)
18
+
19
+ Rewriten for Svelte5 and all the updated goodies that have happened over the last two years. Also moved to Typescript because its the future!
20
+
5
21
  ## Installation
6
22
 
7
23
  You can install it with
@@ -74,15 +90,16 @@ This would render something like
74
90
 
75
91
  ## Note
76
92
 
77
- Just like with React Markdown, this package doesn't use `{@html ...}` unless you need to render HTML.
93
+ Just like with React Markdown, this package doesn't use `{@html ...}`. Even if you add HTML tags to the code, all if it is managed by either the defaults or YOU! If you want to spice things up you can! 🥰
78
94
 
79
95
  ## Props
80
96
 
81
97
  The SvelteMarkdown component accepts the following props:
82
98
 
83
- - `source` - _string_ or _array_ The Markdown source to be parsed, or an array of tokens to be rendered directly.
84
- - `renderers` - _object (optional)_ An object where the keys represent a node type and the value is a Svelte component. This object will be merged with the default renderers. For now you can check how the default renderers are written in the source code at `src/renderers`.
85
- - `options` - _object (optional)_ An object containing [options for Marked](https://marked.js.org/using_advanced#options)
99
+ - `source` - _string_ or _array_ The Markdown source to be parsed, or an array of tokens to be rendered directly.
100
+ - `renderers` - _object (optional)_ An object where the keys represent a node type and the value is a Svelte component. This object will be merged with the default renderers. For now you can check how the default renderers are written in the source code at `src/renderers`.
101
+ - `renderes.html` - _object (optional)_ An object where the key represents the HTML tag and the value is a Svelte component. This object will be merged with the default renderers. For now you can check how the default renderers are written in the source code at `src/renderers/html`.
102
+ - `options` - _object (optional)_ An object containing [options for Marked](https://marked.js.org/using_advanced#options)
86
103
 
87
104
  ## Renderers
88
105
 
@@ -91,10 +108,14 @@ To create custom renderer for an element, you can create a Svelte component with
91
108
  _`ImageComponent.svelte`_
92
109
 
93
110
  ```svelte
94
- <script>
95
- export let href = ''
96
- export let title = undefined
97
- export let text = ''
111
+ <script lang="ts">
112
+ interface Props {
113
+ href?: string
114
+ title?: string
115
+ text?: string
116
+ }
117
+
118
+ const { href = '', title = undefined, text = '' }: Props = $props()
98
119
  </script>
99
120
 
100
121
  <img src={href} {title} alt={text} />
@@ -103,7 +124,7 @@ _`ImageComponent.svelte`_
103
124
  So you can import the component and pass to the `renderers` props:
104
125
 
105
126
  ```svelte
106
- <script>
127
+ <script lang="ts">
107
128
  import SvelteMarkdown from '@humanspeak/svelte-markdown'
108
129
  import ImageComponent from './renderers/ImageComponent.svelte'
109
130
  export let content
@@ -117,7 +138,7 @@ So you can import the component and pass to the `renderers` props:
117
138
  For greater flexibility, an array of tokens may be given as `source`, in which case parsing is skipped and the tokens will be rendered directly. This alows you to generate and transform the tokens freely beforehand. Example:
118
139
 
119
140
  ```html
120
- <script>
141
+ <script lang="ts">
121
142
  import SvelteMarkdown from '@humanspeak/svelte-markdown'
122
143
  import { marked } from 'marked'
123
144
 
@@ -143,7 +164,7 @@ This will render the following:
143
164
  A `parsed` event will be fired when the final tokens have been calculated, allowing you to access the raw token array if needed for things like generating Table of Contents from headings.
144
165
 
145
166
  ```html
146
- <script>
167
+ <script lang="ts">
147
168
  import SvelteMarkdown from '@humanspeak/svelte-markdown'
148
169
 
149
170
  const source = `# This is a header`
@@ -160,26 +181,26 @@ A `parsed` event will be fired when the final tokens have been calculated, allow
160
181
 
161
182
  These would be the property names expected by the `renderers` option.
162
183
 
163
- - `text` - Text rendered inside of other elements, such as paragraphs
164
- - `paragraph` - Paragraph (`<p>`)
165
- - `em` - Emphasis (`<em>`)
166
- - `strong` - Strong/bold (`<strong>`)
167
- - `hr` - Horizontal rule / thematic break (`<hr>`)
168
- - `blockquote` - Block quote (`<blockquote>`)
169
- - `del` - Deleted/strike-through (`<del>`)
170
- - `link` - Link (`<a>`)
171
- - `image` - Image (`<img>`)
172
- - `table` - Table (`<table>`)
173
- - `tablehead` - Table head (`<thead>`)
174
- - `tablebody` - Table body (`<tbody>`)
175
- - `tablerow` - Table row (`<tr>`)
176
- - `tablecell` - Table cell (`<td>`/`<th>`)
177
- - `list` - List (`<ul>`/`<ol>`)
178
- - `listitem` - List item (`<li>`)
179
- - `heading` - Heading (`<h1>`-`<h6>`)
180
- - `codespan` - Inline code (`<code>`)
181
- - `code` - Block of code (`<pre><code>`)
182
- - `html` - HTML node
184
+ - `text` - Text rendered inside of other elements, such as paragraphs
185
+ - `paragraph` - Paragraph (`<p>`)
186
+ - `em` - Emphasis (`<em>`)
187
+ - `strong` - Strong/bold (`<strong>`)
188
+ - `hr` - Horizontal rule / thematic break (`<hr>`)
189
+ - `blockquote` - Block quote (`<blockquote>`)
190
+ - `del` - Deleted/strike-through (`<del>`)
191
+ - `link` - Link (`<a>`)
192
+ - `image` - Image (`<img>`)
193
+ - `table` - Table (`<table>`)
194
+ - `tablehead` - Table head (`<thead>`)
195
+ - `tablebody` - Table body (`<tbody>`)
196
+ - `tablerow` - Table row (`<tr>`)
197
+ - `tablecell` - Table cell (`<td>`/`<th>`)
198
+ - `list` - List (`<ul>`/`<ol>`)
199
+ - `listitem` - List item (`<li>`)
200
+ - `heading` - Heading (`<h1>`-`<h6>`)
201
+ - `codespan` - Inline code (`<code>`)
202
+ - `code` - Block of code (`<pre><code>`)
203
+ - `html` - HTML node
183
204
 
184
205
  ### Optional List Renderers
185
206
 
@@ -187,8 +208,8 @@ For fine detail styling of lists, it can be useful to differentiate between orde
187
208
  If either key is missing, the default `listitem` will be used. There are two
188
209
  optional keys in the `renderers` option which can provide this:
189
210
 
190
- - `orderedlistitem` - A list item appearing inside an ordered list
191
- - `unorderedlistitem` A list item appearing inside an un-ordered list
211
+ - `orderedlistitem` - A list item appearing inside an ordered list
212
+ - `unorderedlistitem` A list item appearing inside an un-ordered list
192
213
 
193
214
  As an example, if we have an `orderedlistitem`:
194
215
 
@@ -229,27 +250,16 @@ Note that the HTML paragraph must be enclosed within `<p>` tags.
229
250
 
230
251
  Some tests have been added to the `tests` folder. You can clone this repo and create another svelte app and link it to this repo to try modifying it.
231
252
 
232
- You can clone this repo and do the following:
253
+ The current extenral dependencies are:
233
254
 
234
- ```console
235
- yarn
236
- yarn link
237
- yarn dev
238
- ```
239
-
240
- This will watch all changes and make the project linkable. Now on the app you created you can link it with:
241
-
242
- ```console
243
- yarn link @humanspeak/svelte-markdown
244
- ```
245
-
246
- And then import it like in the example above.
247
-
248
- As of now the only external dependency of this project is `marked`.
255
+ - [Marked](https://marked.js.org/)
256
+ - [Github-Slugger](https://github.com/Flet/github-slugger)
257
+ - [HTMLParser2](https://github.com/fb55/htmlparser2).
249
258
 
250
259
  ## Related
251
260
 
252
- - [ReactMarkdown](https://github.com/remarkjs/react-markdown) - React library to render markdown using React components. Inspiration for this library.
253
- - [Svelte](https://svelte.dev) - JavaScript front-end framework.
254
- - [Marked](https://marked.js.org/) - Markdown parser
255
- - [Original](https://github.com/pablo-abc/svelte-markdown) - Original component
261
+ - [ReactMarkdown](https://github.com/remarkjs/react-markdown) - React library to render markdown using React components. Inspiration for this library.
262
+ - [Svelte](https://svelte.dev) - JavaScript front-end framework.
263
+ - [Original](https://github.com/pablo-abc/svelte-markdown) - Original component
264
+
265
+ Made with ♥ by [Humanspeak](https://humanspeak.com)
@@ -1,7 +1,13 @@
1
1
  <script lang="ts">
2
2
  import Parser from './Parser.svelte'
3
3
  import Html from './renderers/html/index.js'
4
- import type { Renderers, Token, TokensList, Tokens } from './utils/markdown-parser.js'
4
+ import type {
5
+ Renderers,
6
+ Token,
7
+ TokensList,
8
+ Tokens,
9
+ RendererComponent
10
+ } from './utils/markdown-parser.js'
5
11
 
6
12
  interface Props {
7
13
  type?: string
@@ -28,7 +34,7 @@
28
34
  {#if !type}
29
35
  {#if tokens}
30
36
  {#each tokens as token}
31
- {@const { text, raw, ...parserRest } = rest}
37
+ {@const { text: _text, raw: _raw, ...parserRest } = rest}
32
38
  <Parser {...token} {renderers} {...parserRest} />
33
39
  {/each}
34
40
  {/if}
@@ -40,10 +46,9 @@
40
46
  {#each header ?? [] as headerItem, i}
41
47
  <renderers.tablecell
42
48
  header={true}
43
- align={rest.align[i] || 'center'}
49
+ align={(rest.align as string[])[i] || 'center'}
44
50
  {...rest}
45
51
  >
46
- {rest.align[i]}
47
52
  <Parser tokens={headerItem.tokens} {renderers} />
48
53
  </renderers.tablecell>
49
54
  {/each}
@@ -55,7 +60,7 @@
55
60
  {#each row ?? [] as cells, i}
56
61
  <renderers.tablecell
57
62
  header={false}
58
- align={rest.align[i] ?? 'center'}
63
+ align={(rest.align as string[])[i] ?? 'center'}
59
64
  {...rest}
60
65
  >
61
66
  <Parser tokens={cells.tokens} {renderers} />
@@ -107,10 +112,10 @@
107
112
  />
108
113
  {/if}
109
114
  {:else}
110
- {@const GeneralComponent = renderers[type]}
115
+ {@const GeneralComponent = renderers[type as keyof Renderers] as RendererComponent}
111
116
  <GeneralComponent {...rest}>
112
117
  {#if tokens}
113
- {@const { text, raw, ...parserRest } = rest}
118
+ {@const { text: _text, raw: _raw, ...parserRest } = rest}
114
119
  <Parser {tokens} {renderers} {...parserRest} />
115
120
  {:else}
116
121
  {rest.raw}
@@ -1,3 +1,27 @@
1
+ <!--
2
+ @component
3
+
4
+ A Svelte component that renders Markdown content into HTML using a customizable parser.
5
+ Supports both string input and pre-parsed markdown tokens, with configurable rendering
6
+ options and custom renderers.
7
+
8
+ @example
9
+ ```svelte
10
+ <SvelteMarkdown source="# Hello World" />
11
+
12
+ <SvelteMarkdown
13
+ source={markdownString}
14
+ options={{ headerIds: false }}
15
+ renderers={{ link: CustomLink }}
16
+ />
17
+ ```
18
+
19
+ @property {string | Token[]} source - The markdown content to render, either as a string or pre-parsed tokens
20
+ @property {Partial<Renderers>} [renderers] - Custom renderers for markdown elements
21
+ @property {SvelteMarkdownOptions} [options] - Configuration options for the markdown parser
22
+ @property {boolean} [isInline=false] - Whether to parse the content as inline markdown
23
+ @property {function} [parsed] - Callback function called with the parsed tokens
24
+ -->
1
25
  <script lang="ts">
2
26
  import {
3
27
  Lexer,
@@ -14,7 +38,7 @@
14
38
 
15
39
  interface Props {
16
40
  source: Token[] | string
17
- renderers?: Renderers
41
+ renderers?: Partial<Renderers>
18
42
  options?: SvelteMarkdownOptions
19
43
  isInline?: boolean
20
44
  parsed?: (tokens: Token[] | TokensList) => void // eslint-disable-line no-unused-vars
@@ -30,15 +54,17 @@
30
54
  }: Props & {
31
55
  [key: string]: unknown
32
56
  } = $props()
33
- let tokens: Token[] | TokensList | undefined = $state<Token[] | TokensList | undefined>(
34
- undefined
35
- )
36
- let lexer: Lexer | undefined = undefined
57
+ let tokens: Token[] | undefined
58
+ let previousSource = $state<string | Token[] | undefined>(undefined)
59
+ let lexer: Lexer
37
60
 
38
61
  const slugger = source ? new Slugger() : undefined
39
62
  const combinedOptions = { ...defaultOptions, ...options }
40
63
 
41
64
  $effect.pre(() => {
65
+ if (source === previousSource) return
66
+ previousSource = source
67
+
42
68
  if (Array.isArray(source)) {
43
69
  tokens = shrinkHtmlTokens(source) as Token[]
44
70
  } else {
@@ -48,8 +74,10 @@
48
74
  )
49
75
  }
50
76
  })
77
+
51
78
  $effect(() => {
52
- if (tokens) parsed($state.snapshot(tokens))
79
+ if (!tokens) return
80
+ parsed($state.snapshot(tokens))
53
81
  })
54
82
 
55
83
  const combinedRenderers = {
@@ -60,8 +88,6 @@
60
88
  ...renderers.html
61
89
  }
62
90
  }
63
-
64
- // $inspect(tokens)
65
91
  </script>
66
92
 
67
93
  <Parser
@@ -1,14 +1,34 @@
1
- type Props = {
1
+ import { type Token, type TokensList, type SvelteMarkdownOptions, type Renderers } from './utils/markdown-parser.js';
2
+ /**
3
+ * A Svelte component that renders Markdown content into HTML using a customizable parser.
4
+ * Supports both string input and pre-parsed markdown tokens, with configurable rendering
5
+ * options and custom renderers.
6
+ *
7
+ * @example
8
+ * ```svelte
9
+ * <SvelteMarkdown source="# Hello World" />
10
+ *
11
+ * <SvelteMarkdown
12
+ * source={markdownString}
13
+ * options={{ headerIds: false }}
14
+ * renderers={{ link: CustomLink }}
15
+ * />
16
+ * ```
17
+ *
18
+ * @property {string | Token[]} source - The markdown content to render, either as a string or pre-parsed tokens
19
+ * @property {Partial<Renderers>} [renderers] - Custom renderers for markdown elements
20
+ * @property {SvelteMarkdownOptions} [options] - Configuration options for the markdown parser
21
+ * @property {boolean} [isInline=false] - Whether to parse the content as inline markdown
22
+ * @property {function} [parsed] - Callback function called with the parsed tokens
23
+ */
24
+ declare const SvelteMarkdown: import("svelte").Component<{
2
25
  source: Token[] | string;
3
- renderers?: Renderers;
26
+ renderers?: Partial<Renderers>;
4
27
  options?: SvelteMarkdownOptions;
5
28
  isInline?: boolean;
6
29
  parsed?: (tokens: Token[] | TokensList) => void;
7
- };
8
- type $$ComponentProps = Props & {
30
+ } & {
9
31
  [key: string]: unknown;
10
- };
11
- import { type Token, type TokensList, type SvelteMarkdownOptions, type Renderers } from './utils/markdown-parser.js';
12
- declare const SvelteMarkdown: import("svelte").Component<$$ComponentProps, {}, "">;
32
+ }, {}, "">;
13
33
  type SvelteMarkdown = ReturnType<typeof SvelteMarkdown>;
14
34
  export default SvelteMarkdown;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Blockquote: import("svelte").Component<Props, {}, "">;
6
6
  type Blockquote = ReturnType<typeof Blockquote>;
7
7
  export default Blockquote;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Br: import("svelte").Component<Props, {}, "">;
6
6
  type Br = ReturnType<typeof Br>;
7
7
  export default Br;
@@ -1,7 +1,7 @@
1
- type Props = {
1
+ interface Props {
2
2
  lang: string;
3
3
  text: string;
4
- };
4
+ }
5
5
  declare const Code: import("svelte").Component<Props, {}, "">;
6
6
  type Code = ReturnType<typeof Code>;
7
7
  export default Code;
@@ -1,6 +1,6 @@
1
- type Props = {
1
+ interface Props {
2
2
  raw: string;
3
- };
3
+ }
4
4
  declare const Codespan: import("svelte").Component<Props, {}, "">;
5
5
  type Codespan = ReturnType<typeof Codespan>;
6
6
  export default Codespan;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Del: import("svelte").Component<Props, {}, "">;
6
6
  type Del = ReturnType<typeof Del>;
7
7
  export default Del;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Em: import("svelte").Component<Props, {}, "">;
6
6
  type Em = ReturnType<typeof Em>;
7
7
  export default Em;
@@ -1,13 +1,13 @@
1
- type Props = {
1
+ import type { Snippet } from 'svelte';
2
+ import type { SvelteMarkdownOptions } from '../utils/markdown-parser.js';
3
+ interface Props {
2
4
  depth: number;
3
5
  raw: string;
4
6
  text: string;
5
7
  options: SvelteMarkdownOptions;
6
8
  slug: (val: string) => string;
7
9
  children?: Snippet;
8
- };
9
- import type { Snippet } from 'svelte';
10
- import type { SvelteMarkdownOptions } from '../utils/markdown-parser.js';
10
+ }
11
11
  declare const Heading: import("svelte").Component<Props, {}, "">;
12
12
  type Heading = ReturnType<typeof Heading>;
13
13
  export default Heading;
@@ -1,8 +1,8 @@
1
- type Props = {
1
+ interface Props {
2
2
  href?: string;
3
3
  title?: string;
4
4
  text?: string;
5
- };
5
+ }
6
6
  declare const Image: import("svelte").Component<Props, {}, "">;
7
7
  type Image = ReturnType<typeof Image>;
8
8
  export default Image;
@@ -1,9 +1,9 @@
1
- type Props = {
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
2
3
  href?: string;
3
4
  title?: string;
4
5
  children?: Snippet;
5
- };
6
- import type { Snippet } from 'svelte';
6
+ }
7
7
  declare const Link: import("svelte").Component<Props, {}, "">;
8
8
  type Link = ReturnType<typeof Link>;
9
9
  export default Link;
@@ -1,9 +1,9 @@
1
- type Props = {
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
2
3
  ordered?: boolean;
3
4
  start?: number;
4
5
  children?: Snippet;
5
- };
6
- import type { Snippet } from 'svelte';
6
+ }
7
7
  declare const List: import("svelte").Component<Props, {}, "">;
8
8
  type List = ReturnType<typeof List>;
9
9
  export default List;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const ListItem: import("svelte").Component<Props, {}, "">;
6
6
  type ListItem = ReturnType<typeof ListItem>;
7
7
  export default ListItem;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Paragraph: import("svelte").Component<Props, {}, "">;
6
6
  type Paragraph = ReturnType<typeof Paragraph>;
7
7
  export default Paragraph;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Strong: import("svelte").Component<Props, {}, "">;
6
6
  type Strong = ReturnType<typeof Strong>;
7
7
  export default Strong;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Table: import("svelte").Component<Props, {}, "">;
6
6
  type Table = ReturnType<typeof Table>;
7
7
  export default Table;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const TableBody: import("svelte").Component<Props, {}, "">;
6
6
  type TableBody = ReturnType<typeof TableBody>;
7
7
  export default TableBody;
@@ -1,9 +1,9 @@
1
- type Props = {
1
+ import type { Snippet } from 'svelte';
2
+ interface Props {
2
3
  header: boolean;
3
4
  align: 'left' | 'center' | 'right' | 'justify' | 'char' | null | undefined;
4
5
  children?: Snippet;
5
- };
6
- import type { Snippet } from 'svelte';
6
+ }
7
7
  declare const TableCell: import("svelte").Component<Props, {}, "">;
8
8
  type TableCell = ReturnType<typeof TableCell>;
9
9
  export default TableCell;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const TableHead: import("svelte").Component<Props, {}, "">;
6
6
  type TableHead = ReturnType<typeof TableHead>;
7
7
  export default TableHead;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import type { Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const TableRow: import("svelte").Component<Props, {}, "">;
6
6
  type TableRow = ReturnType<typeof TableRow>;
7
7
  export default TableRow;
@@ -1,7 +1,7 @@
1
- type Props = {
2
- children?: Snippet;
3
- };
4
1
  import { type Snippet } from 'svelte';
2
+ interface Props {
3
+ children?: Snippet;
4
+ }
5
5
  declare const Text: import("svelte").Component<Props, {}, "">;
6
6
  type Text = ReturnType<typeof Text>;
7
7
  export default Text;
@@ -3,7 +3,7 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
- attributes?: Record<string, any>
6
+ attributes?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
7
7
  }
8
8
 
9
9
  const { children, attributes }: Props = $props()
@@ -3,7 +3,7 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
- attributes?: Record<string, any>
6
+ attributes?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
7
7
  }
8
8
 
9
9
  const { children, attributes }: Props = $props()
@@ -3,7 +3,7 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
- attributes?: Record<string, any>
6
+ attributes?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
7
7
  }
8
8
 
9
9
  const { children, attributes }: Props = $props()
@@ -3,7 +3,7 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
- attributes?: Record<string, any>
6
+ attributes?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
7
7
  }
8
8
 
9
9
  const { children, attributes }: Props = $props()
@@ -3,7 +3,7 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
- attributes?: Record<string, any>
6
+ attributes?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
7
7
  }
8
8
 
9
9
  const { children, attributes }: Props = $props()