@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
|
-
|
|
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>
|
|
@@ -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 === '
|
|
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) => ({
|