@humanspeak/svelte-markdown 0.8.5 → 0.8.6

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.
@@ -3,8 +3,11 @@
3
3
 
4
4
  interface Props {
5
5
  children?: Snippet
6
+ listItemIndex?: number
6
7
  }
7
- const { children }: Props = $props()
8
+
9
+ // trunk-ignore(eslint/@typescript-eslint/no-unused-vars,eslint/no-unused-vars)
10
+ const { children, listItemIndex = undefined }: Props = $props()
8
11
  </script>
9
12
 
10
13
  <li>{@render children?.()}</li>
@@ -1,6 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  interface Props {
3
3
  children?: Snippet;
4
+ listItemIndex?: number;
4
5
  }
5
6
  declare const ListItem: import("svelte").Component<Props, {}, "">;
6
7
  type ListItem = ReturnType<typeof ListItem>;
@@ -240,7 +240,15 @@ export const containsMultipleTags = (html) => {
240
240
  export const shrinkHtmlTokens = (tokens) => {
241
241
  const result = [];
242
242
  for (const token of tokens) {
243
- if (token.type === 'table') {
243
+ if (token.type === 'list') {
244
+ token.items = token.items.map((item, index) => ({
245
+ ...item,
246
+ listItemIndex: index,
247
+ tokens: item.tokens ? shrinkHtmlTokens(item.tokens) : []
248
+ }));
249
+ result.push(token);
250
+ }
251
+ else if (token.type === 'table') {
244
252
  // Process header cells
245
253
  if (token.header) {
246
254
  token.header = token.header.map((cell) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanspeak/svelte-markdown",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "A powerful, customizable markdown renderer for Svelte with TypeScript support",
5
5
  "keywords": [
6
6
  "svelte",