@readme/markdown 7.10.1 → 7.10.3
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/lib/migrate.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("@readme/
|
|
3
|
+
module.exports = factory(require("@readme/variable"), require("@tippyjs/react"), require("mermaid"), require("react"));
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["@readme/
|
|
5
|
+
define(["@readme/variable", "@tippyjs/react", "mermaid", "react"], factory);
|
|
6
6
|
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("@readme/
|
|
7
|
+
var a = typeof exports === 'object' ? factory(require("@readme/variable"), require("@tippyjs/react"), require("mermaid"), require("react")) : factory(root["@readme/variable"], root["@tippyjs/react"], root["mermaid"], root["React"]);
|
|
8
8
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
9
|
}
|
|
10
|
-
})(self, (
|
|
10
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__8167__, __WEBPACK_EXTERNAL_MODULE__6570__, __WEBPACK_EXTERNAL_MODULE__1387__, __WEBPACK_EXTERNAL_MODULE__1307__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
@@ -13163,14 +13163,6 @@ module.exports = function () {
|
|
|
13163
13163
|
};
|
|
13164
13164
|
|
|
13165
13165
|
|
|
13166
|
-
/***/ }),
|
|
13167
|
-
|
|
13168
|
-
/***/ 7374:
|
|
13169
|
-
/***/ ((module) => {
|
|
13170
|
-
|
|
13171
|
-
"use strict";
|
|
13172
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__7374__;
|
|
13173
|
-
|
|
13174
13166
|
/***/ }),
|
|
13175
13167
|
|
|
13176
13168
|
/***/ 8167:
|
|
@@ -13896,7 +13888,7 @@ const Image = (Props) => {
|
|
|
13896
13888
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
|
|
13897
13889
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figcaption", null, children || caption)))));
|
|
13898
13890
|
}
|
|
13899
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label":
|
|
13891
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": `${lightbox ? 'Collapse image' : 'Expand image'}`, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
13900
13892
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
|
|
13901
13893
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img ${align ? `img-align-${align}` : ''} ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }))));
|
|
13902
13894
|
};
|
|
@@ -78559,8 +78551,6 @@ const hast = (text, opts = {}) => {
|
|
|
78559
78551
|
};
|
|
78560
78552
|
/* harmony default export */ const lib_hast = (hast);
|
|
78561
78553
|
|
|
78562
|
-
// EXTERNAL MODULE: external "@readme/markdown-legacy"
|
|
78563
|
-
var markdown_legacy_ = __webpack_require__(7374);
|
|
78564
78554
|
;// ./processor/migration/emphasis.ts
|
|
78565
78555
|
|
|
78566
78556
|
const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
@@ -78646,7 +78636,6 @@ const linkReferenceTransformer = () => (tree) => {
|
|
|
78646
78636
|
|
|
78647
78637
|
;// ./processor/migration/table-cell.ts
|
|
78648
78638
|
|
|
78649
|
-
|
|
78650
78639
|
const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
|
|
78651
78640
|
const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
78652
78641
|
// @note: This regex is detect malformed lists that were created by the
|
|
@@ -78671,7 +78660,7 @@ const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
|
78671
78660
|
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
78672
78661
|
// something more standard.
|
|
78673
78662
|
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
78674
|
-
const migrateTableCells = (vfile) => (table) => {
|
|
78663
|
+
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
78675
78664
|
let json;
|
|
78676
78665
|
try {
|
|
78677
78666
|
const { position } = table;
|
|
@@ -78696,7 +78685,7 @@ const migrateTableCells = (vfile) => (table) => {
|
|
|
78696
78685
|
let children = cell.children;
|
|
78697
78686
|
if (json && json.data[magicIndex(i, j)]) {
|
|
78698
78687
|
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
78699
|
-
children =
|
|
78688
|
+
children = rdmd.mdast(string).children;
|
|
78700
78689
|
}
|
|
78701
78690
|
cell.children =
|
|
78702
78691
|
children.length > 1 && !children.some(isInlineHtml)
|
|
@@ -78713,10 +78702,13 @@ const migrateTableCells = (vfile) => (table) => {
|
|
|
78713
78702
|
}
|
|
78714
78703
|
});
|
|
78715
78704
|
};
|
|
78716
|
-
|
|
78717
|
-
|
|
78718
|
-
return tree
|
|
78719
|
-
|
|
78705
|
+
function tableCellTransformer() {
|
|
78706
|
+
const rdmd = this.data('rdmd');
|
|
78707
|
+
return (tree, vfile) => {
|
|
78708
|
+
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
78709
|
+
return tree;
|
|
78710
|
+
};
|
|
78711
|
+
}
|
|
78720
78712
|
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
78721
78713
|
|
|
78722
78714
|
;// ./processor/migration/index.ts
|
|
@@ -78734,14 +78726,13 @@ const transformers = [
|
|
|
78734
78726
|
|
|
78735
78727
|
;// ./lib/mdastV6.ts
|
|
78736
78728
|
|
|
78737
|
-
|
|
78738
78729
|
const migrationNormalize = (doc) => {
|
|
78739
78730
|
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
78740
78731
|
};
|
|
78741
|
-
const mdastV6 = (doc) => {
|
|
78742
|
-
const [_normalizedDoc] =
|
|
78732
|
+
const mdastV6 = (doc, { rdmd }) => {
|
|
78733
|
+
const [_normalizedDoc] = rdmd.setup(doc);
|
|
78743
78734
|
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
78744
|
-
const proc =
|
|
78735
|
+
const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
|
|
78745
78736
|
const tree = proc.parse(normalizedDoc);
|
|
78746
78737
|
proc.runSync(tree, normalizedDoc);
|
|
78747
78738
|
return tree;
|
|
@@ -83664,8 +83655,8 @@ const tags = (doc) => {
|
|
|
83664
83655
|
;// ./lib/migrate.ts
|
|
83665
83656
|
|
|
83666
83657
|
|
|
83667
|
-
const migrate = (doc) => {
|
|
83668
|
-
return lib_mdx(lib_mdastV6(doc)).replaceAll(/ /g, ' ');
|
|
83658
|
+
const migrate = (doc, { rdmd }) => {
|
|
83659
|
+
return lib_mdx(lib_mdastV6(doc, { rdmd })).replaceAll(/ /g, ' ');
|
|
83669
83660
|
};
|
|
83670
83661
|
/* harmony default export */ const lib_migrate = (migrate);
|
|
83671
83662
|
|
package/dist/main.node.js
CHANGED
|
@@ -13404,7 +13404,7 @@ const Image = (Props) => {
|
|
|
13404
13404
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
|
|
13405
13405
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figcaption", null, children || caption)))));
|
|
13406
13406
|
}
|
|
13407
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label":
|
|
13407
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": `${lightbox ? 'Collapse image' : 'Expand image'}`, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
13408
13408
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
|
|
13409
13409
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img ${align ? `img-align-${align}` : ''} ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }))));
|
|
13410
13410
|
};
|
|
@@ -79630,8 +79630,6 @@ const hast = (text, opts = {}) => {
|
|
|
79630
79630
|
};
|
|
79631
79631
|
/* harmony default export */ const lib_hast = (hast);
|
|
79632
79632
|
|
|
79633
|
-
;// external "@readme/markdown-legacy"
|
|
79634
|
-
const markdown_legacy_namespaceObject = require("@readme/markdown-legacy");
|
|
79635
79633
|
;// ./processor/migration/emphasis.ts
|
|
79636
79634
|
|
|
79637
79635
|
const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
@@ -79717,7 +79715,6 @@ const linkReferenceTransformer = () => (tree) => {
|
|
|
79717
79715
|
|
|
79718
79716
|
;// ./processor/migration/table-cell.ts
|
|
79719
79717
|
|
|
79720
|
-
|
|
79721
79718
|
const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
|
|
79722
79719
|
const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
79723
79720
|
// @note: This regex is detect malformed lists that were created by the
|
|
@@ -79742,7 +79739,7 @@ const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
|
79742
79739
|
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
79743
79740
|
// something more standard.
|
|
79744
79741
|
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
79745
|
-
const migrateTableCells = (vfile) => (table) => {
|
|
79742
|
+
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
79746
79743
|
let json;
|
|
79747
79744
|
try {
|
|
79748
79745
|
const { position } = table;
|
|
@@ -79767,7 +79764,7 @@ const migrateTableCells = (vfile) => (table) => {
|
|
|
79767
79764
|
let children = cell.children;
|
|
79768
79765
|
if (json && json.data[magicIndex(i, j)]) {
|
|
79769
79766
|
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
79770
|
-
children =
|
|
79767
|
+
children = rdmd.mdast(string).children;
|
|
79771
79768
|
}
|
|
79772
79769
|
cell.children =
|
|
79773
79770
|
children.length > 1 && !children.some(isInlineHtml)
|
|
@@ -79784,10 +79781,13 @@ const migrateTableCells = (vfile) => (table) => {
|
|
|
79784
79781
|
}
|
|
79785
79782
|
});
|
|
79786
79783
|
};
|
|
79787
|
-
|
|
79788
|
-
|
|
79789
|
-
return tree
|
|
79790
|
-
|
|
79784
|
+
function tableCellTransformer() {
|
|
79785
|
+
const rdmd = this.data('rdmd');
|
|
79786
|
+
return (tree, vfile) => {
|
|
79787
|
+
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
79788
|
+
return tree;
|
|
79789
|
+
};
|
|
79790
|
+
}
|
|
79791
79791
|
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
79792
79792
|
|
|
79793
79793
|
;// ./processor/migration/index.ts
|
|
@@ -79805,14 +79805,13 @@ const transformers = [
|
|
|
79805
79805
|
|
|
79806
79806
|
;// ./lib/mdastV6.ts
|
|
79807
79807
|
|
|
79808
|
-
|
|
79809
79808
|
const migrationNormalize = (doc) => {
|
|
79810
79809
|
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
79811
79810
|
};
|
|
79812
|
-
const mdastV6 = (doc) => {
|
|
79813
|
-
const [_normalizedDoc] =
|
|
79811
|
+
const mdastV6 = (doc, { rdmd }) => {
|
|
79812
|
+
const [_normalizedDoc] = rdmd.setup(doc);
|
|
79814
79813
|
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
79815
|
-
const proc =
|
|
79814
|
+
const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
|
|
79816
79815
|
const tree = proc.parse(normalizedDoc);
|
|
79817
79816
|
proc.runSync(tree, normalizedDoc);
|
|
79818
79817
|
return tree;
|
|
@@ -84735,8 +84734,8 @@ const tags = (doc) => {
|
|
|
84735
84734
|
;// ./lib/migrate.ts
|
|
84736
84735
|
|
|
84737
84736
|
|
|
84738
|
-
const migrate = (doc) => {
|
|
84739
|
-
return lib_mdx(lib_mdastV6(doc)).replaceAll(/ /g, ' ');
|
|
84737
|
+
const migrate = (doc, { rdmd }) => {
|
|
84738
|
+
return lib_mdx(lib_mdastV6(doc, { rdmd })).replaceAll(/ /g, ' ');
|
|
84740
84739
|
};
|
|
84741
84740
|
/* harmony default export */ const lib_migrate = (migrate);
|
|
84742
84741
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import tableCellTransformer from './table-cell';
|
|
2
|
+
declare const transformers: ((() => (tree: any) => void) | typeof tableCellTransformer)[];
|
|
2
3
|
export default transformers;
|
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": "7.10.
|
|
5
|
+
"version": "7.10.3",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@mdx-js/react": "^3.0.0",
|
|
62
|
-
"@readme/markdown-legacy": "npm:@readme/markdown@^6.87.1",
|
|
63
62
|
"@readme/variable": "^16.1.0",
|
|
64
63
|
"@tippyjs/react": "^4.1.0",
|
|
65
64
|
"react": "16.x || 17.x || 18.x",
|
|
@@ -81,6 +80,7 @@
|
|
|
81
80
|
"@commitlint/config-angular": "^19",
|
|
82
81
|
"@commitlint/config-conventional": "^19",
|
|
83
82
|
"@readme/eslint-config": "^14.0.0",
|
|
83
|
+
"@readme/markdown-legacy": "npm:@readme/markdown@^6.87.1",
|
|
84
84
|
"@semantic-release/changelog": "^6.0.3",
|
|
85
85
|
"@semantic-release/git": "^10.0.1",
|
|
86
86
|
"@testing-library/jest-dom": "^6.4.2",
|