@markdoc/markdoc 0.5.3 → 0.5.5
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/index.js +4 -4
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +2 -2
- package/dist/src/transforms/table.d.ts +1 -1
- package/dist/src/transforms/table.d.ts.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/formatter.test.ts +2 -0
- package/src/formatter.ts +1 -1
- package/src/parser.test.ts +97 -0
- package/src/parser.ts +1 -1
- package/src/transforms/table.ts +9 -2
- package/src/types.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -7224,7 +7224,7 @@ function* formatNode(n, o = {}) {
|
|
|
7224
7224
|
if (o.parent && WRAPPING_TYPES.includes(o.parent.type)) {
|
|
7225
7225
|
yield* escapeMarkdownCharacters(content, /[*_~]/g);
|
|
7226
7226
|
} else {
|
|
7227
|
-
yield* escapeMarkdownCharacters(content, /^\*|#+\s
|
|
7227
|
+
yield* escapeMarkdownCharacters(content, /^\*|#+\s|^>/);
|
|
7228
7228
|
}
|
|
7229
7229
|
}
|
|
7230
7230
|
break;
|
|
@@ -7569,7 +7569,7 @@ function convertToRow(node2, cellType = "td") {
|
|
|
7569
7569
|
cell.type = cellType;
|
|
7570
7570
|
return node2;
|
|
7571
7571
|
}
|
|
7572
|
-
function transform(document2) {
|
|
7572
|
+
function transform(document2, conditionalTags = ["if"]) {
|
|
7573
7573
|
for (const node2 of document2.walk()) {
|
|
7574
7574
|
if (node2.type !== "tag" || node2.tag !== "table")
|
|
7575
7575
|
continue;
|
|
@@ -7586,7 +7586,7 @@ function transform(document2) {
|
|
|
7586
7586
|
for (const row of rest) {
|
|
7587
7587
|
if (row.type === "list")
|
|
7588
7588
|
convertToRow(row);
|
|
7589
|
-
else if (row.type === "tag" && row.tag
|
|
7589
|
+
else if (row.type === "tag" && row.tag && conditionalTags.includes(row.tag)) {
|
|
7590
7590
|
const children = [];
|
|
7591
7591
|
for (const child of row.children) {
|
|
7592
7592
|
if (child.type === "hr")
|
|
@@ -7779,7 +7779,7 @@ function parser(tokens, args) {
|
|
|
7779
7779
|
message: `Node '${node2.tag || node2.type}' is missing closing`
|
|
7780
7780
|
});
|
|
7781
7781
|
for (const transform3 of transforms_default)
|
|
7782
|
-
transform3(doc);
|
|
7782
|
+
transform3(doc, args?.conditionalTags);
|
|
7783
7783
|
return doc;
|
|
7784
7784
|
}
|
|
7785
7785
|
|