@readme/markdown 6.75.0-beta.70 → 6.75.0-beta.71
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
CHANGED
|
@@ -65950,6 +65950,91 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
|
65950
65950
|
};
|
|
65951
65951
|
/* harmony default export */ const transform_variables = (variables);
|
|
65952
65952
|
|
|
65953
|
+
;// CONCATENATED MODULE: ./processor/transform/tables-to-jsx.ts
|
|
65954
|
+
|
|
65955
|
+
|
|
65956
|
+
|
|
65957
|
+
|
|
65958
|
+
|
|
65959
|
+
const visitor = (table, index, parent) => {
|
|
65960
|
+
let hasFlowContent = false;
|
|
65961
|
+
const tableCellVisitor = (cell) => {
|
|
65962
|
+
if (!phrasing(cell.children[0])) {
|
|
65963
|
+
hasFlowContent = true;
|
|
65964
|
+
return EXIT;
|
|
65965
|
+
}
|
|
65966
|
+
visit(cell, 'text', (text) => {
|
|
65967
|
+
if (text.value.match(/\n/)) {
|
|
65968
|
+
hasFlowContent = true;
|
|
65969
|
+
return EXIT;
|
|
65970
|
+
}
|
|
65971
|
+
});
|
|
65972
|
+
};
|
|
65973
|
+
visit(table, 'tableCell', tableCellVisitor);
|
|
65974
|
+
if (!hasFlowContent)
|
|
65975
|
+
return;
|
|
65976
|
+
const head = {
|
|
65977
|
+
type: 'mdxJsxFlowElement',
|
|
65978
|
+
name: 'thead',
|
|
65979
|
+
children: [
|
|
65980
|
+
{
|
|
65981
|
+
type: 'mdxJsxFlowElement',
|
|
65982
|
+
name: 'tr',
|
|
65983
|
+
children: table.children[0].children.map((cell, idx) => {
|
|
65984
|
+
const proxy = fromMarkdown(`<div style={{ align: "${table.align[idx]}" }}></div>`, {
|
|
65985
|
+
extensions: [mdxJsx()],
|
|
65986
|
+
mdastExtensions: [mdxJsxFromMarkdown()],
|
|
65987
|
+
});
|
|
65988
|
+
// @ts-ignore
|
|
65989
|
+
const { attributes } = proxy.children[0];
|
|
65990
|
+
return {
|
|
65991
|
+
type: 'mdxJsxFlowElement',
|
|
65992
|
+
name: 'th',
|
|
65993
|
+
attributes,
|
|
65994
|
+
children: cell.children,
|
|
65995
|
+
};
|
|
65996
|
+
}),
|
|
65997
|
+
},
|
|
65998
|
+
],
|
|
65999
|
+
};
|
|
66000
|
+
const body = {
|
|
66001
|
+
type: 'mdxJsxFlowElement',
|
|
66002
|
+
name: 'tbody',
|
|
66003
|
+
children: table.children.splice(1).map(row => {
|
|
66004
|
+
return {
|
|
66005
|
+
type: 'mdxJsxFlowElement',
|
|
66006
|
+
name: 'tr',
|
|
66007
|
+
children: row.children.map((cell, idx) => {
|
|
66008
|
+
const proxy = fromMarkdown(`<div style={{ align: "${table.align[idx]}" }}></div>`, {
|
|
66009
|
+
extensions: [mdxJsx()],
|
|
66010
|
+
mdastExtensions: [mdxJsxFromMarkdown()],
|
|
66011
|
+
});
|
|
66012
|
+
// @ts-ignore
|
|
66013
|
+
const { attributes } = proxy.children[0];
|
|
66014
|
+
return {
|
|
66015
|
+
type: 'mdxJsxFlowElement',
|
|
66016
|
+
name: 'th',
|
|
66017
|
+
attributes,
|
|
66018
|
+
children: cell.children,
|
|
66019
|
+
};
|
|
66020
|
+
}),
|
|
66021
|
+
};
|
|
66022
|
+
}),
|
|
66023
|
+
};
|
|
66024
|
+
const jsx = {
|
|
66025
|
+
type: 'mdxJsxFlowElement',
|
|
66026
|
+
name: 'Table',
|
|
66027
|
+
children: [head, body],
|
|
66028
|
+
};
|
|
66029
|
+
// @ts-ignore
|
|
66030
|
+
parent.children[index] = jsx;
|
|
66031
|
+
};
|
|
66032
|
+
const tablesToJsx = () => tree => {
|
|
66033
|
+
visit(tree, 'table', visitor);
|
|
66034
|
+
return tree;
|
|
66035
|
+
};
|
|
66036
|
+
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
66037
|
+
|
|
65953
66038
|
;// CONCATENATED MODULE: ./processor/transform/index.ts
|
|
65954
66039
|
|
|
65955
66040
|
|
|
@@ -65962,7 +66047,8 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
|
65962
66047
|
|
|
65963
66048
|
|
|
65964
66049
|
|
|
65965
|
-
|
|
66050
|
+
|
|
66051
|
+
/* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
|
|
65966
66052
|
|
|
65967
66053
|
;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
|
|
65968
66054
|
// This module is generated by `script/`.
|
|
@@ -94562,14 +94648,14 @@ function compilers() {
|
|
|
94562
94648
|
|
|
94563
94649
|
|
|
94564
94650
|
|
|
94565
|
-
|
|
94566
94651
|
const mdx_mdx = (tree, { hast = false } = {}) => {
|
|
94567
94652
|
const processor = unified()
|
|
94568
94653
|
.use(hast ? rehypeRemark : undefined)
|
|
94569
94654
|
.use(remarkMdx)
|
|
94570
94655
|
.use(remarkGfm)
|
|
94571
|
-
.use(
|
|
94656
|
+
.use(div)
|
|
94572
94657
|
.use(readme_to_mdx)
|
|
94658
|
+
.use(tables_to_jsx)
|
|
94573
94659
|
.use(remarkStringify)
|
|
94574
94660
|
.use(processor_compile);
|
|
94575
94661
|
return processor.stringify(processor.runSync(tree));
|
package/dist/main.node.js
CHANGED
|
@@ -67403,6 +67403,91 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
|
67403
67403
|
};
|
|
67404
67404
|
/* harmony default export */ const transform_variables = (variables);
|
|
67405
67405
|
|
|
67406
|
+
;// CONCATENATED MODULE: ./processor/transform/tables-to-jsx.ts
|
|
67407
|
+
|
|
67408
|
+
|
|
67409
|
+
|
|
67410
|
+
|
|
67411
|
+
|
|
67412
|
+
const visitor = (table, index, parent) => {
|
|
67413
|
+
let hasFlowContent = false;
|
|
67414
|
+
const tableCellVisitor = (cell) => {
|
|
67415
|
+
if (!phrasing(cell.children[0])) {
|
|
67416
|
+
hasFlowContent = true;
|
|
67417
|
+
return EXIT;
|
|
67418
|
+
}
|
|
67419
|
+
visit(cell, 'text', (text) => {
|
|
67420
|
+
if (text.value.match(/\n/)) {
|
|
67421
|
+
hasFlowContent = true;
|
|
67422
|
+
return EXIT;
|
|
67423
|
+
}
|
|
67424
|
+
});
|
|
67425
|
+
};
|
|
67426
|
+
visit(table, 'tableCell', tableCellVisitor);
|
|
67427
|
+
if (!hasFlowContent)
|
|
67428
|
+
return;
|
|
67429
|
+
const head = {
|
|
67430
|
+
type: 'mdxJsxFlowElement',
|
|
67431
|
+
name: 'thead',
|
|
67432
|
+
children: [
|
|
67433
|
+
{
|
|
67434
|
+
type: 'mdxJsxFlowElement',
|
|
67435
|
+
name: 'tr',
|
|
67436
|
+
children: table.children[0].children.map((cell, idx) => {
|
|
67437
|
+
const proxy = fromMarkdown(`<div style={{ align: "${table.align[idx]}" }}></div>`, {
|
|
67438
|
+
extensions: [mdxJsx()],
|
|
67439
|
+
mdastExtensions: [mdxJsxFromMarkdown()],
|
|
67440
|
+
});
|
|
67441
|
+
// @ts-ignore
|
|
67442
|
+
const { attributes } = proxy.children[0];
|
|
67443
|
+
return {
|
|
67444
|
+
type: 'mdxJsxFlowElement',
|
|
67445
|
+
name: 'th',
|
|
67446
|
+
attributes,
|
|
67447
|
+
children: cell.children,
|
|
67448
|
+
};
|
|
67449
|
+
}),
|
|
67450
|
+
},
|
|
67451
|
+
],
|
|
67452
|
+
};
|
|
67453
|
+
const body = {
|
|
67454
|
+
type: 'mdxJsxFlowElement',
|
|
67455
|
+
name: 'tbody',
|
|
67456
|
+
children: table.children.splice(1).map(row => {
|
|
67457
|
+
return {
|
|
67458
|
+
type: 'mdxJsxFlowElement',
|
|
67459
|
+
name: 'tr',
|
|
67460
|
+
children: row.children.map((cell, idx) => {
|
|
67461
|
+
const proxy = fromMarkdown(`<div style={{ align: "${table.align[idx]}" }}></div>`, {
|
|
67462
|
+
extensions: [mdxJsx()],
|
|
67463
|
+
mdastExtensions: [mdxJsxFromMarkdown()],
|
|
67464
|
+
});
|
|
67465
|
+
// @ts-ignore
|
|
67466
|
+
const { attributes } = proxy.children[0];
|
|
67467
|
+
return {
|
|
67468
|
+
type: 'mdxJsxFlowElement',
|
|
67469
|
+
name: 'th',
|
|
67470
|
+
attributes,
|
|
67471
|
+
children: cell.children,
|
|
67472
|
+
};
|
|
67473
|
+
}),
|
|
67474
|
+
};
|
|
67475
|
+
}),
|
|
67476
|
+
};
|
|
67477
|
+
const jsx = {
|
|
67478
|
+
type: 'mdxJsxFlowElement',
|
|
67479
|
+
name: 'Table',
|
|
67480
|
+
children: [head, body],
|
|
67481
|
+
};
|
|
67482
|
+
// @ts-ignore
|
|
67483
|
+
parent.children[index] = jsx;
|
|
67484
|
+
};
|
|
67485
|
+
const tablesToJsx = () => tree => {
|
|
67486
|
+
visit(tree, 'table', visitor);
|
|
67487
|
+
return tree;
|
|
67488
|
+
};
|
|
67489
|
+
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
67490
|
+
|
|
67406
67491
|
;// CONCATENATED MODULE: ./processor/transform/index.ts
|
|
67407
67492
|
|
|
67408
67493
|
|
|
@@ -67415,7 +67500,8 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
|
|
|
67415
67500
|
|
|
67416
67501
|
|
|
67417
67502
|
|
|
67418
|
-
|
|
67503
|
+
|
|
67504
|
+
/* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
|
|
67419
67505
|
|
|
67420
67506
|
;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
|
|
67421
67507
|
// This module is generated by `script/`.
|
|
@@ -96015,14 +96101,14 @@ function compilers() {
|
|
|
96015
96101
|
|
|
96016
96102
|
|
|
96017
96103
|
|
|
96018
|
-
|
|
96019
96104
|
const mdx_mdx = (tree, { hast = false } = {}) => {
|
|
96020
96105
|
const processor = unified()
|
|
96021
96106
|
.use(hast ? rehypeRemark : undefined)
|
|
96022
96107
|
.use(remarkMdx)
|
|
96023
96108
|
.use(remarkGfm)
|
|
96024
|
-
.use(
|
|
96109
|
+
.use(transform_div)
|
|
96025
96110
|
.use(readme_to_mdx)
|
|
96111
|
+
.use(tables_to_jsx)
|
|
96026
96112
|
.use(remarkStringify)
|
|
96027
96113
|
.use(processor_compile);
|
|
96028
96114
|
return processor.stringify(processor.runSync(tree));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import divTransformer from './div';
|
|
1
2
|
import injectComponents from './inject-components';
|
|
2
3
|
import readmeComponentsTransformer from './readme-components';
|
|
3
4
|
import readmeToMdx from './readme-to-mdx';
|
|
4
5
|
import variablesTransformer from './variables';
|
|
5
|
-
|
|
6
|
+
import tablesToJsx from './tables-to-jsx';
|
|
7
|
+
export { divTransformer, readmeComponentsTransformer, readmeToMdx, injectComponents, variablesTransformer, tablesToJsx, };
|
|
6
8
|
declare const _default: (() => (tree: any) => void)[];
|
|
7
9
|
export default _default;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "6.75.0-beta.
|
|
5
|
+
"version": "6.75.0-beta.71",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"lodash.escape": "^4.0.1",
|
|
41
41
|
"lodash.kebabcase": "^4.1.1",
|
|
42
42
|
"mdast-util-find-and-replace": "^3.0.1",
|
|
43
|
+
"mdast-util-phrasing": "^4.1.0",
|
|
43
44
|
"path-browserify": "^1.0.1",
|
|
44
45
|
"process": "^0.11.10",
|
|
45
46
|
"prop-types": "^15.8.1",
|