@readme/markdown 15.6.0 → 15.7.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/main.js +17 -6
- package/dist/main.node.js +17 -6
- package/dist/main.node.js.map +1 -1
- package/dist/render-fixture.node.js +17 -6
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +5 -0
package/dist/main.js
CHANGED
|
@@ -81088,6 +81088,8 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
81088
81088
|
type: 'table',
|
|
81089
81089
|
position,
|
|
81090
81090
|
children,
|
|
81091
|
+
// Remember the author's spelling so the serializer can write `<table>` back instead of `<Table>`
|
|
81092
|
+
...(node.name === 'table' && { data: { lowercaseTable: true } }),
|
|
81091
81093
|
};
|
|
81092
81094
|
parent.children[index] = mdNode;
|
|
81093
81095
|
};
|
|
@@ -96690,7 +96692,7 @@ const rehypeToc = ({ components = {} }) => {
|
|
|
96690
96692
|
});
|
|
96691
96693
|
};
|
|
96692
96694
|
};
|
|
96693
|
-
const MAX_DEPTH =
|
|
96695
|
+
const MAX_DEPTH = 3;
|
|
96694
96696
|
/**
|
|
96695
96697
|
* Get the depth of a heading element based on its tag name.
|
|
96696
96698
|
*
|
|
@@ -107666,13 +107668,22 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
107666
107668
|
gfmCells.push([cell, normalized]);
|
|
107667
107669
|
return undefined;
|
|
107668
107670
|
});
|
|
107669
|
-
|
|
107671
|
+
const stayLowercase = table.data?.lowercaseTable === true;
|
|
107672
|
+
// We transform to GFM tables if:
|
|
107673
|
+
// 1. If it doesn't contain complex elements that the syntax can't represent
|
|
107674
|
+
// 2. The original table is not lowercase HTML <table>, because we want to
|
|
107675
|
+
// preserve original tables as much as possible
|
|
107676
|
+
if (!requiresJsxTable && !stayLowercase) {
|
|
107670
107677
|
gfmCells.forEach(([cell, children]) => {
|
|
107671
107678
|
cell.children = children;
|
|
107672
107679
|
});
|
|
107673
107680
|
table.type = 'table';
|
|
107674
107681
|
return;
|
|
107675
107682
|
}
|
|
107683
|
+
// Nothing to build a JSX table from; leave the empty node to the GFM stringifier.
|
|
107684
|
+
const [headerRow, ...bodyRows] = table.children;
|
|
107685
|
+
if (!headerRow)
|
|
107686
|
+
return;
|
|
107676
107687
|
visit(table, mdxish_tables_to_jsx_isTableCell, flattenBreaksToNewlines);
|
|
107677
107688
|
const styles = table.align.map(mdxish_tables_to_jsx_alignToStyle);
|
|
107678
107689
|
const head = {
|
|
@@ -107684,7 +107695,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
107684
107695
|
attributes: [],
|
|
107685
107696
|
type: 'mdxJsxFlowElement',
|
|
107686
107697
|
name: 'tr',
|
|
107687
|
-
children:
|
|
107698
|
+
children: headerRow.children.map((cell, cellIndex) => {
|
|
107688
107699
|
return {
|
|
107689
107700
|
attributes: [],
|
|
107690
107701
|
type: 'mdxJsxFlowElement',
|
|
@@ -107700,7 +107711,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
107700
107711
|
attributes: [],
|
|
107701
107712
|
type: 'mdxJsxFlowElement',
|
|
107702
107713
|
name: 'tbody',
|
|
107703
|
-
children:
|
|
107714
|
+
children: bodyRows.map(row => {
|
|
107704
107715
|
return {
|
|
107705
107716
|
attributes: [],
|
|
107706
107717
|
type: 'mdxJsxFlowElement',
|
|
@@ -107728,8 +107739,8 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
107728
107739
|
];
|
|
107729
107740
|
const jsx = {
|
|
107730
107741
|
type: 'mdxJsxFlowElement',
|
|
107731
|
-
name: 'Table',
|
|
107732
|
-
attributes: table.align.find(a => a) ? attributes : [],
|
|
107742
|
+
name: stayLowercase ? 'table' : 'Table',
|
|
107743
|
+
attributes: !stayLowercase && table.align.find(a => a) ? attributes : [],
|
|
107733
107744
|
children: [head, body],
|
|
107734
107745
|
};
|
|
107735
107746
|
parent.children[index] = jsx;
|
package/dist/main.node.js
CHANGED
|
@@ -101271,6 +101271,8 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
101271
101271
|
type: 'table',
|
|
101272
101272
|
position,
|
|
101273
101273
|
children,
|
|
101274
|
+
// Remember the author's spelling so the serializer can write `<table>` back instead of `<Table>`
|
|
101275
|
+
...(node.name === 'table' && { data: { lowercaseTable: true } }),
|
|
101274
101276
|
};
|
|
101275
101277
|
parent.children[index] = mdNode;
|
|
101276
101278
|
};
|
|
@@ -116873,7 +116875,7 @@ const rehypeToc = ({ components = {} }) => {
|
|
|
116873
116875
|
});
|
|
116874
116876
|
};
|
|
116875
116877
|
};
|
|
116876
|
-
const MAX_DEPTH =
|
|
116878
|
+
const MAX_DEPTH = 3;
|
|
116877
116879
|
/**
|
|
116878
116880
|
* Get the depth of a heading element based on its tag name.
|
|
116879
116881
|
*
|
|
@@ -127849,13 +127851,22 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127849
127851
|
gfmCells.push([cell, normalized]);
|
|
127850
127852
|
return undefined;
|
|
127851
127853
|
});
|
|
127852
|
-
|
|
127854
|
+
const stayLowercase = table.data?.lowercaseTable === true;
|
|
127855
|
+
// We transform to GFM tables if:
|
|
127856
|
+
// 1. If it doesn't contain complex elements that the syntax can't represent
|
|
127857
|
+
// 2. The original table is not lowercase HTML <table>, because we want to
|
|
127858
|
+
// preserve original tables as much as possible
|
|
127859
|
+
if (!requiresJsxTable && !stayLowercase) {
|
|
127853
127860
|
gfmCells.forEach(([cell, children]) => {
|
|
127854
127861
|
cell.children = children;
|
|
127855
127862
|
});
|
|
127856
127863
|
table.type = 'table';
|
|
127857
127864
|
return;
|
|
127858
127865
|
}
|
|
127866
|
+
// Nothing to build a JSX table from; leave the empty node to the GFM stringifier.
|
|
127867
|
+
const [headerRow, ...bodyRows] = table.children;
|
|
127868
|
+
if (!headerRow)
|
|
127869
|
+
return;
|
|
127859
127870
|
visit(table, mdxish_tables_to_jsx_isTableCell, flattenBreaksToNewlines);
|
|
127860
127871
|
const styles = table.align.map(mdxish_tables_to_jsx_alignToStyle);
|
|
127861
127872
|
const head = {
|
|
@@ -127867,7 +127878,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127867
127878
|
attributes: [],
|
|
127868
127879
|
type: 'mdxJsxFlowElement',
|
|
127869
127880
|
name: 'tr',
|
|
127870
|
-
children:
|
|
127881
|
+
children: headerRow.children.map((cell, cellIndex) => {
|
|
127871
127882
|
return {
|
|
127872
127883
|
attributes: [],
|
|
127873
127884
|
type: 'mdxJsxFlowElement',
|
|
@@ -127883,7 +127894,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127883
127894
|
attributes: [],
|
|
127884
127895
|
type: 'mdxJsxFlowElement',
|
|
127885
127896
|
name: 'tbody',
|
|
127886
|
-
children:
|
|
127897
|
+
children: bodyRows.map(row => {
|
|
127887
127898
|
return {
|
|
127888
127899
|
attributes: [],
|
|
127889
127900
|
type: 'mdxJsxFlowElement',
|
|
@@ -127911,8 +127922,8 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127911
127922
|
];
|
|
127912
127923
|
const jsx = {
|
|
127913
127924
|
type: 'mdxJsxFlowElement',
|
|
127914
|
-
name: 'Table',
|
|
127915
|
-
attributes: table.align.find(a => a) ? attributes : [],
|
|
127925
|
+
name: stayLowercase ? 'table' : 'Table',
|
|
127926
|
+
attributes: !stayLowercase && table.align.find(a => a) ? attributes : [],
|
|
127916
127927
|
children: [head, body],
|
|
127917
127928
|
};
|
|
127918
127929
|
parent.children[index] = jsx;
|