@readme/markdown 7.8.0 → 7.9.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/index.d.ts CHANGED
@@ -5,5 +5,5 @@ declare const utils: {
5
5
  getHref: any;
6
6
  calloutIcons: {};
7
7
  };
8
- export { compile, hast, run, mdast, mdastV6, mdx, plain, remarkPlugins, tags } from './lib';
8
+ export { compile, hast, run, mdast, mdastV6, mdx, migrate, plain, remarkPlugins, tags } from './lib';
9
9
  export { Components, utils };
@@ -1,11 +1,11 @@
1
- import astProcessor, { MdastOpts, remarkPlugins } from './ast-processor';
2
- import compile from './compile';
3
- import hast from './hast';
4
- import mdast from './mdast';
5
- import mdastV6 from './mdastV6';
6
- import mdx from './mdx';
7
- import plain from './plain';
8
- import run from './run';
9
- import tags from './tags';
10
- export type { MdastOpts };
11
- export { astProcessor, compile, hast, mdast, mdastV6, mdx, plain, run, remarkPlugins, tags };
1
+ export type { MdastOpts } from './ast-processor';
2
+ export { default as astProcessor, remarkPlugins } from './ast-processor';
3
+ export { default as compile } from './compile';
4
+ export { default as hast } from './hast';
5
+ export { default as mdast } from './mdast';
6
+ export { default as mdastV6 } from './mdastV6';
7
+ export { default as mdx } from './mdx';
8
+ export { default as plain } from './plain';
9
+ export { default as run } from './run';
10
+ export { default as tags } from './tags';
11
+ export { default as migrate } from './migrate';
@@ -0,0 +1,2 @@
1
+ declare const migrate: (doc: string) => string;
2
+ export default migrate;
package/dist/main.js CHANGED
@@ -13330,6 +13330,7 @@ __webpack_require__.d(__webpack_exports__, {
13330
13330
  mdast: () => (/* reexport */ lib_mdast),
13331
13331
  mdastV6: () => (/* reexport */ lib_mdastV6),
13332
13332
  mdx: () => (/* reexport */ lib_mdx),
13333
+ migrate: () => (/* reexport */ lib_migrate),
13333
13334
  plain: () => (/* reexport */ lib_plain),
13334
13335
  remarkPlugins: () => (/* reexport */ remarkPlugins),
13335
13336
  run: () => (/* reexport */ lib_run),
@@ -78508,6 +78509,7 @@ const linkReferenceTransformer = () => (tree) => {
78508
78509
 
78509
78510
 
78510
78511
  const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
78512
+ const isInlineHtml = node => node.type === 'html' && !node.block;
78511
78513
  // @note: This regex is detect malformed lists that were created by the
78512
78514
  // markdown editor. Consider the following markdown:
78513
78515
  //
@@ -78557,8 +78559,10 @@ const migrateTableCells = (vfile) => (table) => {
78557
78559
  const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
78558
78560
  children = markdown_legacy_.mdast(string).children;
78559
78561
  }
78560
- // eslint-disable-next-line no-param-reassign
78561
- cell.children = children.length > 1 ? children : [{ type: 'paragraph', children }];
78562
+ cell.children =
78563
+ children.length > 1 && !children.some(isInlineHtml)
78564
+ ? children
78565
+ : [{ type: 'paragraph', children }];
78562
78566
  return SKIP;
78563
78567
  });
78564
78568
  return SKIP;
@@ -83519,6 +83523,14 @@ const tags = (doc) => {
83519
83523
  };
83520
83524
  /* harmony default export */ const lib_tags = (tags);
83521
83525
 
83526
+ ;// ./lib/migrate.ts
83527
+
83528
+
83529
+ const migrate = (doc) => {
83530
+ return lib_mdx(lib_mdastV6(doc)).replaceAll(/&#x20;/g, ' ');
83531
+ };
83532
+ /* harmony default export */ const lib_migrate = (migrate);
83533
+
83522
83534
  ;// ./lib/index.ts
83523
83535
 
83524
83536
 
package/dist/main.node.js CHANGED
@@ -7961,6 +7961,7 @@ __webpack_require__.d(__webpack_exports__, {
7961
7961
  mdast: () => (/* reexport */ lib_mdast),
7962
7962
  mdastV6: () => (/* reexport */ lib_mdastV6),
7963
7963
  mdx: () => (/* reexport */ lib_mdx),
7964
+ migrate: () => (/* reexport */ lib_migrate),
7964
7965
  plain: () => (/* reexport */ lib_plain),
7965
7966
  remarkPlugins: () => (/* reexport */ remarkPlugins),
7966
7967
  run: () => (/* reexport */ lib_run),
@@ -79579,6 +79580,7 @@ const linkReferenceTransformer = () => (tree) => {
79579
79580
 
79580
79581
 
79581
79582
  const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
79583
+ const isInlineHtml = node => node.type === 'html' && !node.block;
79582
79584
  // @note: This regex is detect malformed lists that were created by the
79583
79585
  // markdown editor. Consider the following markdown:
79584
79586
  //
@@ -79628,8 +79630,10 @@ const migrateTableCells = (vfile) => (table) => {
79628
79630
  const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
79629
79631
  children = markdown_legacy_namespaceObject.mdast(string).children;
79630
79632
  }
79631
- // eslint-disable-next-line no-param-reassign
79632
- cell.children = children.length > 1 ? children : [{ type: 'paragraph', children }];
79633
+ cell.children =
79634
+ children.length > 1 && !children.some(isInlineHtml)
79635
+ ? children
79636
+ : [{ type: 'paragraph', children }];
79633
79637
  return SKIP;
79634
79638
  });
79635
79639
  return SKIP;
@@ -84590,6 +84594,14 @@ const tags = (doc) => {
84590
84594
  };
84591
84595
  /* harmony default export */ const lib_tags = (tags);
84592
84596
 
84597
+ ;// ./lib/migrate.ts
84598
+
84599
+
84600
+ const migrate = (doc) => {
84601
+ return lib_mdx(lib_mdastV6(doc)).replaceAll(/&#x20;/g, ' ');
84602
+ };
84603
+ /* harmony default export */ const lib_migrate = (migrate);
84604
+
84593
84605
  ;// ./lib/index.ts
84594
84606
 
84595
84607
 
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.8.0",
5
+ "version": "7.9.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",