@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
|
@@ -101217,6 +101217,8 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
101217
101217
|
type: 'table',
|
|
101218
101218
|
position,
|
|
101219
101219
|
children,
|
|
101220
|
+
// Remember the author's spelling so the serializer can write `<table>` back instead of `<Table>`
|
|
101221
|
+
...(node.name === 'table' && { data: { lowercaseTable: true } }),
|
|
101220
101222
|
};
|
|
101221
101223
|
parent.children[index] = mdNode;
|
|
101222
101224
|
};
|
|
@@ -116819,7 +116821,7 @@ const rehypeToc = ({ components = {} }) => {
|
|
|
116819
116821
|
});
|
|
116820
116822
|
};
|
|
116821
116823
|
};
|
|
116822
|
-
const MAX_DEPTH =
|
|
116824
|
+
const MAX_DEPTH = 3;
|
|
116823
116825
|
/**
|
|
116824
116826
|
* Get the depth of a heading element based on its tag name.
|
|
116825
116827
|
*
|
|
@@ -127590,13 +127592,22 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127590
127592
|
gfmCells.push([cell, normalized]);
|
|
127591
127593
|
return undefined;
|
|
127592
127594
|
});
|
|
127593
|
-
|
|
127595
|
+
const stayLowercase = table.data?.lowercaseTable === true;
|
|
127596
|
+
// We transform to GFM tables if:
|
|
127597
|
+
// 1. If it doesn't contain complex elements that the syntax can't represent
|
|
127598
|
+
// 2. The original table is not lowercase HTML <table>, because we want to
|
|
127599
|
+
// preserve original tables as much as possible
|
|
127600
|
+
if (!requiresJsxTable && !stayLowercase) {
|
|
127594
127601
|
gfmCells.forEach(([cell, children]) => {
|
|
127595
127602
|
cell.children = children;
|
|
127596
127603
|
});
|
|
127597
127604
|
table.type = 'table';
|
|
127598
127605
|
return;
|
|
127599
127606
|
}
|
|
127607
|
+
// Nothing to build a JSX table from; leave the empty node to the GFM stringifier.
|
|
127608
|
+
const [headerRow, ...bodyRows] = table.children;
|
|
127609
|
+
if (!headerRow)
|
|
127610
|
+
return;
|
|
127600
127611
|
mdxish_tables_to_jsx_visit(table, mdxish_tables_to_jsx_isTableCell, flattenBreaksToNewlines);
|
|
127601
127612
|
const styles = table.align.map(mdxish_tables_to_jsx_alignToStyle);
|
|
127602
127613
|
const head = {
|
|
@@ -127608,7 +127619,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127608
127619
|
attributes: [],
|
|
127609
127620
|
type: 'mdxJsxFlowElement',
|
|
127610
127621
|
name: 'tr',
|
|
127611
|
-
children:
|
|
127622
|
+
children: headerRow.children.map((cell, cellIndex) => {
|
|
127612
127623
|
return {
|
|
127613
127624
|
attributes: [],
|
|
127614
127625
|
type: 'mdxJsxFlowElement',
|
|
@@ -127624,7 +127635,7 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127624
127635
|
attributes: [],
|
|
127625
127636
|
type: 'mdxJsxFlowElement',
|
|
127626
127637
|
name: 'tbody',
|
|
127627
|
-
children:
|
|
127638
|
+
children: bodyRows.map(row => {
|
|
127628
127639
|
return {
|
|
127629
127640
|
attributes: [],
|
|
127630
127641
|
type: 'mdxJsxFlowElement',
|
|
@@ -127652,8 +127663,8 @@ const mdxishTablesToJsx = () => tree => {
|
|
|
127652
127663
|
];
|
|
127653
127664
|
const jsx = {
|
|
127654
127665
|
type: 'mdxJsxFlowElement',
|
|
127655
|
-
name: 'Table',
|
|
127656
|
-
attributes: table.align.find(a => a) ? attributes : [],
|
|
127666
|
+
name: stayLowercase ? 'table' : 'Table',
|
|
127667
|
+
attributes: !stayLowercase && table.align.find(a => a) ? attributes : [],
|
|
127657
127668
|
children: [head, body],
|
|
127658
127669
|
};
|
|
127659
127670
|
parent.children[index] = jsx;
|