@markdoc/markdoc 0.5.4 → 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 +3 -3
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +3 -3
- 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/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.mjs
CHANGED
|
@@ -7544,7 +7544,7 @@ function convertToRow(node2, cellType = "td") {
|
|
|
7544
7544
|
cell.type = cellType;
|
|
7545
7545
|
return node2;
|
|
7546
7546
|
}
|
|
7547
|
-
function transform(document2) {
|
|
7547
|
+
function transform(document2, conditionalTags = ["if"]) {
|
|
7548
7548
|
for (const node2 of document2.walk()) {
|
|
7549
7549
|
if (node2.type !== "tag" || node2.tag !== "table")
|
|
7550
7550
|
continue;
|
|
@@ -7561,7 +7561,7 @@ function transform(document2) {
|
|
|
7561
7561
|
for (const row of rest) {
|
|
7562
7562
|
if (row.type === "list")
|
|
7563
7563
|
convertToRow(row);
|
|
7564
|
-
else if (row.type === "tag" && row.tag
|
|
7564
|
+
else if (row.type === "tag" && row.tag && conditionalTags.includes(row.tag)) {
|
|
7565
7565
|
const children = [];
|
|
7566
7566
|
for (const child of row.children) {
|
|
7567
7567
|
if (child.type === "hr")
|
|
@@ -7754,7 +7754,7 @@ function parser(tokens, args) {
|
|
|
7754
7754
|
message: `Node '${node2.tag || node2.type}' is missing closing`
|
|
7755
7755
|
});
|
|
7756
7756
|
for (const transform3 of transforms_default)
|
|
7757
|
-
transform3(doc);
|
|
7757
|
+
transform3(doc, args?.conditionalTags);
|
|
7758
7758
|
return doc;
|
|
7759
7759
|
}
|
|
7760
7760
|
|