@jxsuite/parser 0.29.0 → 0.31.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.
- package/dist/markdown.js +2007 -817
- package/dist/serialize.js +2006 -816
- package/package.json +4 -4
- package/src/Markdown.class.json +1 -1
- package/src/serialize.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Jx markdown parser and external class integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"upgrade": "bunx npm-check-updates -u && bun install"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@jxsuite/schema": "^0.
|
|
43
|
+
"@jxsuite/schema": "^0.31.0",
|
|
44
44
|
"glob": "^13.0.6",
|
|
45
45
|
"hast-util-from-html": "^2.0.3",
|
|
46
46
|
"hast-util-whitespace": "^3.0.0",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"yaml": "^2.9.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@happy-dom/global-registrator": "^20.10.
|
|
63
|
-
"@jxsuite/runtime": "^0.
|
|
62
|
+
"@happy-dom/global-registrator": "^20.10.6",
|
|
63
|
+
"@jxsuite/runtime": "^0.31.0",
|
|
64
64
|
"@types/hast": "^3.0.4",
|
|
65
65
|
"@types/mdast": "^4.0.4"
|
|
66
66
|
}
|
package/src/Markdown.class.json
CHANGED
package/src/serialize.ts
CHANGED
|
@@ -532,7 +532,7 @@ function convertJxNode(
|
|
|
532
532
|
case "heading": {
|
|
533
533
|
return {
|
|
534
534
|
children: inline(el),
|
|
535
|
-
depth:
|
|
535
|
+
depth: Math.trunc(Number(tag.slice(1))),
|
|
536
536
|
type: "heading",
|
|
537
537
|
};
|
|
538
538
|
}
|
|
@@ -584,7 +584,7 @@ function convertJxNode(
|
|
|
584
584
|
.filter(Boolean) as MdastNode[],
|
|
585
585
|
ordered: tag === "ol",
|
|
586
586
|
spread: false,
|
|
587
|
-
start: tag === "ol" ?
|
|
587
|
+
start: tag === "ol" ? Math.trunc(Number(el.attributes?.start as string)) || 1 : null,
|
|
588
588
|
type: "list",
|
|
589
589
|
};
|
|
590
590
|
}
|
|
@@ -932,7 +932,7 @@ function nodeToMdast(
|
|
|
932
932
|
|
|
933
933
|
switch (mdastType) {
|
|
934
934
|
case "heading": {
|
|
935
|
-
const depth =
|
|
935
|
+
const depth = Math.trunc(Number(tag.slice(1)));
|
|
936
936
|
const children =
|
|
937
937
|
text != null ? [{ type: "text", value: text }] : exportChildren(node, ctx, scope);
|
|
938
938
|
return [{ children, depth, type: "heading" }];
|
|
@@ -1343,7 +1343,7 @@ function splitHtmlBlocks(html: string) {
|
|
|
1343
1343
|
function parseHtmlElement(html: string) {
|
|
1344
1344
|
const hMatch = html.match(/^<(h[1-6])(?:\s[^>]*)?>(.+?)<\/\1>$/is);
|
|
1345
1345
|
if (hMatch) {
|
|
1346
|
-
const depth =
|
|
1346
|
+
const depth = Math.trunc(Number(hMatch[1]!.slice(1)));
|
|
1347
1347
|
const children = parseInlineHtml(hMatch[2]!);
|
|
1348
1348
|
return [{ children, depth, type: "heading" }];
|
|
1349
1349
|
}
|