@readme/markdown 7.10.3 → 7.11.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 CHANGED
@@ -65253,6 +65253,31 @@ const gemojiTransformer = () => (tree) => {
65253
65253
  };
65254
65254
  /* harmony default export */ const gemoji_ = (gemojiTransformer);
65255
65255
 
65256
+ ;// ./processor/transform/compatability.ts
65257
+
65258
+
65259
+ const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
65260
+ const compatibilityTransfomer = () => tree => {
65261
+ const trimEmphasis = (node) => {
65262
+ visit(node, 'text', child => {
65263
+ child.value = child.value.trim();
65264
+ return EXIT;
65265
+ });
65266
+ return node;
65267
+ };
65268
+ visit(tree, strongTest, node => {
65269
+ trimEmphasis(node);
65270
+ return SKIP;
65271
+ });
65272
+ visit(tree, 'image', (node, index, parent) => {
65273
+ if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
65274
+ return;
65275
+ parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
65276
+ });
65277
+ return tree;
65278
+ };
65279
+ /* harmony default export */ const compatability = (compatibilityTransfomer);
65280
+
65256
65281
  ;// ./processor/transform/div.ts
65257
65282
  var div_rest = (undefined && undefined.__rest) || function (s, e) {
65258
65283
  var t = {};
@@ -65301,6 +65326,41 @@ const injectComponents = (opts) => () => tree => {
65301
65326
  };
65302
65327
  /* harmony default export */ const inject_components = (injectComponents);
65303
65328
 
65329
+ ;// ./processor/transform/mdx-to-hast.ts
65330
+
65331
+
65332
+
65333
+ const setData = (node, index, parent) => {
65334
+ if (!node.name)
65335
+ return;
65336
+ if (!(node.name in components_namespaceObject))
65337
+ return;
65338
+ parent.children[index] = Object.assign(Object.assign({}, node), { data: {
65339
+ hName: node.name,
65340
+ hProperties: getAttrs(node),
65341
+ } });
65342
+ };
65343
+ const mdxToHast = () => tree => {
65344
+ visit(tree, isMDXElement, setData);
65345
+ return tree;
65346
+ };
65347
+ /* harmony default export */ const mdx_to_hast = (mdxToHast);
65348
+
65349
+ ;// ./processor/transform/mermaid.ts
65350
+
65351
+ const mermaidTransformer = () => (tree) => {
65352
+ visit(tree, 'element', (node) => {
65353
+ if (node.tagName !== 'pre' || node.children.length !== 1)
65354
+ return;
65355
+ const [child] = node.children;
65356
+ if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
65357
+ node.properties = Object.assign(Object.assign({}, node.properties), { className: ['mermaid', ...(node.properties.className || [])] });
65358
+ }
65359
+ });
65360
+ return tree;
65361
+ };
65362
+ /* harmony default export */ const transform_mermaid = (mermaidTransformer);
65363
+
65304
65364
  ;// ./processor/transform/readme-components.ts
65305
65365
 
65306
65366
 
@@ -65539,47 +65599,6 @@ const readmeToMdx = () => tree => {
65539
65599
  };
65540
65600
  /* harmony default export */ const readme_to_mdx = (readmeToMdx);
65541
65601
 
65542
- ;// ./processor/transform/variables.ts
65543
-
65544
-
65545
- const variables = ({ asMdx } = { asMdx: true }) => tree => {
65546
- visit(tree, (node, index, parent) => {
65547
- if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
65548
- return;
65549
- const match = node.value.match(/^user\.(?<value>.*)$/);
65550
- if (!match)
65551
- return;
65552
- let variable = asMdx
65553
- ? {
65554
- type: 'mdxJsxTextElement',
65555
- name: 'Variable',
65556
- attributes: [
65557
- {
65558
- type: 'mdxJsxAttribute',
65559
- name: 'name',
65560
- value: match.groups.value,
65561
- },
65562
- ],
65563
- children: [],
65564
- position: node.position,
65565
- }
65566
- : {
65567
- type: NodeTypes.variable,
65568
- data: {
65569
- hName: 'Variable',
65570
- hProperties: {
65571
- name: match.groups.value,
65572
- },
65573
- },
65574
- value: `{${node.value}}`,
65575
- position: node.position,
65576
- };
65577
- parent.children.splice(index, 1, variable);
65578
- });
65579
- return tree;
65580
- };
65581
- /* harmony default export */ const transform_variables = (variables);
65582
-
65583
65602
  ;// ./processor/transform/tables-to-jsx.ts
65584
65603
 
65585
65604
 
@@ -65608,7 +65627,7 @@ const visitor = (table, index, parent) => {
65608
65627
  visit(cell, 'break', (_, index, parent) => {
65609
65628
  parent.children.splice(index, 1, { type: 'text', value: '\n' });
65610
65629
  });
65611
- if (!phrasing(content)) {
65630
+ if (!phrasing(content) && content.type !== 'escape') {
65612
65631
  hasFlowContent = true;
65613
65632
  return EXIT;
65614
65633
  }
@@ -65672,45 +65691,57 @@ const tablesToJsx = () => tree => {
65672
65691
  };
65673
65692
  /* harmony default export */ const tables_to_jsx = (tablesToJsx);
65674
65693
 
65675
- ;// ./processor/transform/compatability.ts
65694
+ ;// ./processor/transform/variables.ts
65676
65695
 
65677
65696
 
65678
- const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
65679
- const compatibilityTransfomer = () => tree => {
65680
- const trimEmphasis = (node) => {
65681
- visit(node, 'text', child => {
65682
- child.value = child.value.trim();
65683
- return EXIT;
65684
- });
65685
- return node;
65686
- };
65687
- visit(tree, strongTest, node => {
65688
- trimEmphasis(node);
65689
- return SKIP;
65690
- });
65691
- visit(tree, 'image', (node, index, parent) => {
65692
- if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
65697
+ const variables = ({ asMdx } = { asMdx: true }) => tree => {
65698
+ visit(tree, (node, index, parent) => {
65699
+ var _a, _b;
65700
+ if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
65693
65701
  return;
65694
- parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
65695
- });
65696
- return tree;
65697
- };
65698
- /* harmony default export */ const compatability = (compatibilityTransfomer);
65699
-
65700
- ;// ./processor/transform/mermaid.ts
65701
-
65702
- const mermaidTransformer = () => (tree) => {
65703
- visit(tree, 'element', (node) => {
65704
- if (node.tagName !== 'pre' || node.children.length !== 1)
65702
+ // @ts-expect-error - estree is not defined on our mdx types?!
65703
+ if (node.data.estree.type !== 'Program')
65705
65704
  return;
65706
- const [child] = node.children;
65707
- if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
65708
- node.properties = Object.assign(Object.assign({}, node.properties), { className: ['mermaid', ...(node.properties.className || [])] });
65709
- }
65705
+ // @ts-expect-error - estree is not defined on our mdx types?!
65706
+ const [expression] = node.data.estree.body;
65707
+ if (!expression ||
65708
+ expression.type !== 'ExpressionStatement' ||
65709
+ ((_a = expression.expression.object) === null || _a === void 0 ? void 0 : _a.name) !== 'user' ||
65710
+ !['Literal', 'Identifier'].includes((_b = expression.expression.property) === null || _b === void 0 ? void 0 : _b.type))
65711
+ return;
65712
+ const name = expression.expression.property.type === 'Identifier'
65713
+ ? expression.expression.property.name
65714
+ : expression.expression.property.value;
65715
+ let variable = asMdx
65716
+ ? {
65717
+ type: 'mdxJsxTextElement',
65718
+ name: 'Variable',
65719
+ attributes: [
65720
+ {
65721
+ type: 'mdxJsxAttribute',
65722
+ name: 'name',
65723
+ value: name,
65724
+ },
65725
+ ],
65726
+ children: [],
65727
+ position: node.position,
65728
+ }
65729
+ : {
65730
+ type: NodeTypes.variable,
65731
+ data: {
65732
+ hName: 'Variable',
65733
+ hProperties: {
65734
+ name,
65735
+ },
65736
+ },
65737
+ value: `{${node.value}}`,
65738
+ position: node.position,
65739
+ };
65740
+ parent.children.splice(index, 1, variable);
65710
65741
  });
65711
65742
  return tree;
65712
65743
  };
65713
- /* harmony default export */ const transform_mermaid = (mermaidTransformer);
65744
+ /* harmony default export */ const transform_variables = (variables);
65714
65745
 
65715
65746
  ;// ./processor/transform/index.ts
65716
65747
 
@@ -65727,6 +65758,7 @@ const mermaidTransformer = () => (tree) => {
65727
65758
 
65728
65759
 
65729
65760
 
65761
+
65730
65762
  const defaultTransforms = {
65731
65763
  calloutTransformer: callouts,
65732
65764
  codeTabsTransformer: code_tabs,
@@ -78546,7 +78578,11 @@ const hast = (text, opts = {}) => {
78546
78578
  memo[name] = lib_mdast(doc);
78547
78579
  return memo;
78548
78580
  }, {});
78549
- const processor = ast_processor(opts).use(inject_components({ components })).use(remarkRehype).use(rehypePlugins);
78581
+ const processor = ast_processor(opts)
78582
+ .use(inject_components({ components }))
78583
+ .use(mdx_to_hast)
78584
+ .use(remarkRehype)
78585
+ .use(rehypePlugins);
78550
78586
  return processor.runSync(processor.parse(text));
78551
78587
  };
78552
78588
  /* harmony default export */ const lib_hast = (hast);
@@ -78716,12 +78752,7 @@ function tableCellTransformer() {
78716
78752
 
78717
78753
 
78718
78754
 
78719
- const transformers = [
78720
- migration_emphasis,
78721
- migration_images,
78722
- migration_linkReference,
78723
- table_cell,
78724
- ];
78755
+ const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
78725
78756
  /* harmony default export */ const migration = (transformers);
78726
78757
 
78727
78758
  ;// ./lib/mdastV6.ts
@@ -83395,7 +83426,7 @@ const variable = (node) => {
83395
83426
  // @note: coming from RDMD, it's set as `variable`. But when mdx is parsed,
83396
83427
  // it's set as `name`
83397
83428
  const name = node.data.hProperties.variable || node.data.hProperties.name;
83398
- return `{user.${name}}`;
83429
+ return name.toString().match(/ /) ? `{user[${JSON.stringify(name)}]}` : `{user.${name}}`;
83399
83430
  };
83400
83431
  /* harmony default export */ const compile_variable = (variable);
83401
83432
 
@@ -83470,7 +83501,7 @@ const mdx_mdx = (tree, _a = {}) => {
83470
83501
 
83471
83502
  const STRIP_TAGS = ['script', 'style'];
83472
83503
  function plain_one(node, opts) {
83473
- var _a, _b;
83504
+ var _a, _b, _c;
83474
83505
  if (node.type === 'comment')
83475
83506
  return '';
83476
83507
  if ('type' in node && node.type === 'text') {
@@ -83479,27 +83510,37 @@ function plain_one(node, opts) {
83479
83510
  if ('tagName' in node) {
83480
83511
  if (STRIP_TAGS.includes(node.tagName))
83481
83512
  return '';
83482
- if (node.tagName === 'html-block') {
83483
- if (!node.properties.html)
83484
- return '';
83485
- return plain_all(lib_hast(node.properties.html.toString()), opts);
83486
- }
83487
- if (node.tagName === 'rdme-callout') {
83488
- const { icon, title } = node.properties;
83489
- const children = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a.slice(title ? 1 : 0);
83490
- const body = children ? plain_all({ type: 'root', children }, opts) : '';
83491
- return [icon, ' ', title, title && body && ': ', body].filter(Boolean).join('');
83492
- }
83493
- if (node.tagName === 'readme-glossary-item') {
83494
- return node.properties.term;
83495
- }
83496
- if (node.tagName === 'readme-variable') {
83497
- const key = node.properties.variable.toString();
83498
- const val = opts.variables[key];
83499
- return val || `<<${key}>>`;
83500
- }
83501
- if (node.tagName === 'img') {
83502
- return ((_b = node.properties) === null || _b === void 0 ? void 0 : _b.title) || '';
83513
+ switch (node.tagName) {
83514
+ case 'html-block': {
83515
+ if (!node.properties.html)
83516
+ return '';
83517
+ return plain_all(lib_hast(node.properties.html.toString()), opts);
83518
+ }
83519
+ case 'rdme-callout': {
83520
+ const { icon, title } = node.properties;
83521
+ const children = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a.slice(title ? 1 : 0);
83522
+ const body = children ? plain_all({ type: 'root', children }, opts) : '';
83523
+ return [icon, ' ', title, title && body && ': ', body].filter(Boolean).join('');
83524
+ }
83525
+ case 'readme-glossary-item': {
83526
+ return node.properties.term;
83527
+ }
83528
+ case 'readme-variable': {
83529
+ const key = node.properties.variable.toString();
83530
+ const val = opts.variables[key];
83531
+ return val || `<<${key}>>`;
83532
+ }
83533
+ case 'img': {
83534
+ return ((_b = node.properties) === null || _b === void 0 ? void 0 : _b.title) || '';
83535
+ }
83536
+ case 'Accordion':
83537
+ case 'Card':
83538
+ case 'Tab': {
83539
+ const title = ((_c = node.properties) === null || _c === void 0 ? void 0 : _c.title) || '';
83540
+ const children = node === null || node === void 0 ? void 0 : node.children;
83541
+ const body = children ? plain_all({ type: 'root', children }, opts) : '';
83542
+ return [title, body].filter(Boolean).join(' ');
83543
+ }
83503
83544
  }
83504
83545
  }
83505
83546
  if ('value' in node) {
package/dist/main.node.js CHANGED
@@ -66332,6 +66332,31 @@ const gemojiTransformer = () => (tree) => {
66332
66332
  };
66333
66333
  /* harmony default export */ const gemoji_ = (gemojiTransformer);
66334
66334
 
66335
+ ;// ./processor/transform/compatability.ts
66336
+
66337
+
66338
+ const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
66339
+ const compatibilityTransfomer = () => tree => {
66340
+ const trimEmphasis = (node) => {
66341
+ visit(node, 'text', child => {
66342
+ child.value = child.value.trim();
66343
+ return EXIT;
66344
+ });
66345
+ return node;
66346
+ };
66347
+ visit(tree, strongTest, node => {
66348
+ trimEmphasis(node);
66349
+ return SKIP;
66350
+ });
66351
+ visit(tree, 'image', (node, index, parent) => {
66352
+ if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
66353
+ return;
66354
+ parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
66355
+ });
66356
+ return tree;
66357
+ };
66358
+ /* harmony default export */ const compatability = (compatibilityTransfomer);
66359
+
66335
66360
  ;// ./processor/transform/div.ts
66336
66361
  var div_rest = (undefined && undefined.__rest) || function (s, e) {
66337
66362
  var t = {};
@@ -66380,6 +66405,41 @@ const injectComponents = (opts) => () => tree => {
66380
66405
  };
66381
66406
  /* harmony default export */ const inject_components = (injectComponents);
66382
66407
 
66408
+ ;// ./processor/transform/mdx-to-hast.ts
66409
+
66410
+
66411
+
66412
+ const setData = (node, index, parent) => {
66413
+ if (!node.name)
66414
+ return;
66415
+ if (!(node.name in components_namespaceObject))
66416
+ return;
66417
+ parent.children[index] = Object.assign(Object.assign({}, node), { data: {
66418
+ hName: node.name,
66419
+ hProperties: getAttrs(node),
66420
+ } });
66421
+ };
66422
+ const mdxToHast = () => tree => {
66423
+ visit(tree, isMDXElement, setData);
66424
+ return tree;
66425
+ };
66426
+ /* harmony default export */ const mdx_to_hast = (mdxToHast);
66427
+
66428
+ ;// ./processor/transform/mermaid.ts
66429
+
66430
+ const mermaidTransformer = () => (tree) => {
66431
+ visit(tree, 'element', (node) => {
66432
+ if (node.tagName !== 'pre' || node.children.length !== 1)
66433
+ return;
66434
+ const [child] = node.children;
66435
+ if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
66436
+ node.properties = Object.assign(Object.assign({}, node.properties), { className: ['mermaid', ...(node.properties.className || [])] });
66437
+ }
66438
+ });
66439
+ return tree;
66440
+ };
66441
+ /* harmony default export */ const transform_mermaid = (mermaidTransformer);
66442
+
66383
66443
  ;// ./processor/transform/readme-components.ts
66384
66444
 
66385
66445
 
@@ -66618,47 +66678,6 @@ const readmeToMdx = () => tree => {
66618
66678
  };
66619
66679
  /* harmony default export */ const readme_to_mdx = (readmeToMdx);
66620
66680
 
66621
- ;// ./processor/transform/variables.ts
66622
-
66623
-
66624
- const variables = ({ asMdx } = { asMdx: true }) => tree => {
66625
- visit(tree, (node, index, parent) => {
66626
- if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
66627
- return;
66628
- const match = node.value.match(/^user\.(?<value>.*)$/);
66629
- if (!match)
66630
- return;
66631
- let variable = asMdx
66632
- ? {
66633
- type: 'mdxJsxTextElement',
66634
- name: 'Variable',
66635
- attributes: [
66636
- {
66637
- type: 'mdxJsxAttribute',
66638
- name: 'name',
66639
- value: match.groups.value,
66640
- },
66641
- ],
66642
- children: [],
66643
- position: node.position,
66644
- }
66645
- : {
66646
- type: NodeTypes.variable,
66647
- data: {
66648
- hName: 'Variable',
66649
- hProperties: {
66650
- name: match.groups.value,
66651
- },
66652
- },
66653
- value: `{${node.value}}`,
66654
- position: node.position,
66655
- };
66656
- parent.children.splice(index, 1, variable);
66657
- });
66658
- return tree;
66659
- };
66660
- /* harmony default export */ const transform_variables = (variables);
66661
-
66662
66681
  ;// ./processor/transform/tables-to-jsx.ts
66663
66682
 
66664
66683
 
@@ -66687,7 +66706,7 @@ const visitor = (table, index, parent) => {
66687
66706
  visit(cell, 'break', (_, index, parent) => {
66688
66707
  parent.children.splice(index, 1, { type: 'text', value: '\n' });
66689
66708
  });
66690
- if (!phrasing(content)) {
66709
+ if (!phrasing(content) && content.type !== 'escape') {
66691
66710
  hasFlowContent = true;
66692
66711
  return EXIT;
66693
66712
  }
@@ -66751,45 +66770,57 @@ const tablesToJsx = () => tree => {
66751
66770
  };
66752
66771
  /* harmony default export */ const tables_to_jsx = (tablesToJsx);
66753
66772
 
66754
- ;// ./processor/transform/compatability.ts
66773
+ ;// ./processor/transform/variables.ts
66755
66774
 
66756
66775
 
66757
- const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
66758
- const compatibilityTransfomer = () => tree => {
66759
- const trimEmphasis = (node) => {
66760
- visit(node, 'text', child => {
66761
- child.value = child.value.trim();
66762
- return EXIT;
66763
- });
66764
- return node;
66765
- };
66766
- visit(tree, strongTest, node => {
66767
- trimEmphasis(node);
66768
- return SKIP;
66769
- });
66770
- visit(tree, 'image', (node, index, parent) => {
66771
- if (phrasing(parent) || !parent.children.every(child => child.type === 'image' || !phrasing(child)))
66776
+ const variables = ({ asMdx } = { asMdx: true }) => tree => {
66777
+ visit(tree, (node, index, parent) => {
66778
+ var _a, _b;
66779
+ if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
66772
66780
  return;
66773
- parent.children.splice(index, 1, { type: 'paragraph', children: [node] });
66774
- });
66775
- return tree;
66776
- };
66777
- /* harmony default export */ const compatability = (compatibilityTransfomer);
66778
-
66779
- ;// ./processor/transform/mermaid.ts
66780
-
66781
- const mermaidTransformer = () => (tree) => {
66782
- visit(tree, 'element', (node) => {
66783
- if (node.tagName !== 'pre' || node.children.length !== 1)
66781
+ // @ts-expect-error - estree is not defined on our mdx types?!
66782
+ if (node.data.estree.type !== 'Program')
66784
66783
  return;
66785
- const [child] = node.children;
66786
- if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
66787
- node.properties = Object.assign(Object.assign({}, node.properties), { className: ['mermaid', ...(node.properties.className || [])] });
66788
- }
66784
+ // @ts-expect-error - estree is not defined on our mdx types?!
66785
+ const [expression] = node.data.estree.body;
66786
+ if (!expression ||
66787
+ expression.type !== 'ExpressionStatement' ||
66788
+ ((_a = expression.expression.object) === null || _a === void 0 ? void 0 : _a.name) !== 'user' ||
66789
+ !['Literal', 'Identifier'].includes((_b = expression.expression.property) === null || _b === void 0 ? void 0 : _b.type))
66790
+ return;
66791
+ const name = expression.expression.property.type === 'Identifier'
66792
+ ? expression.expression.property.name
66793
+ : expression.expression.property.value;
66794
+ let variable = asMdx
66795
+ ? {
66796
+ type: 'mdxJsxTextElement',
66797
+ name: 'Variable',
66798
+ attributes: [
66799
+ {
66800
+ type: 'mdxJsxAttribute',
66801
+ name: 'name',
66802
+ value: name,
66803
+ },
66804
+ ],
66805
+ children: [],
66806
+ position: node.position,
66807
+ }
66808
+ : {
66809
+ type: NodeTypes.variable,
66810
+ data: {
66811
+ hName: 'Variable',
66812
+ hProperties: {
66813
+ name,
66814
+ },
66815
+ },
66816
+ value: `{${node.value}}`,
66817
+ position: node.position,
66818
+ };
66819
+ parent.children.splice(index, 1, variable);
66789
66820
  });
66790
66821
  return tree;
66791
66822
  };
66792
- /* harmony default export */ const transform_mermaid = (mermaidTransformer);
66823
+ /* harmony default export */ const transform_variables = (variables);
66793
66824
 
66794
66825
  ;// ./processor/transform/index.ts
66795
66826
 
@@ -66806,6 +66837,7 @@ const mermaidTransformer = () => (tree) => {
66806
66837
 
66807
66838
 
66808
66839
 
66840
+
66809
66841
  const defaultTransforms = {
66810
66842
  calloutTransformer: callouts,
66811
66843
  codeTabsTransformer: code_tabs,
@@ -79625,7 +79657,11 @@ const hast = (text, opts = {}) => {
79625
79657
  memo[name] = lib_mdast(doc);
79626
79658
  return memo;
79627
79659
  }, {});
79628
- const processor = ast_processor(opts).use(inject_components({ components })).use(remarkRehype).use(rehypePlugins);
79660
+ const processor = ast_processor(opts)
79661
+ .use(inject_components({ components }))
79662
+ .use(mdx_to_hast)
79663
+ .use(remarkRehype)
79664
+ .use(rehypePlugins);
79629
79665
  return processor.runSync(processor.parse(text));
79630
79666
  };
79631
79667
  /* harmony default export */ const lib_hast = (hast);
@@ -79795,12 +79831,7 @@ function tableCellTransformer() {
79795
79831
 
79796
79832
 
79797
79833
 
79798
- const transformers = [
79799
- migration_emphasis,
79800
- migration_images,
79801
- migration_linkReference,
79802
- table_cell,
79803
- ];
79834
+ const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
79804
79835
  /* harmony default export */ const migration = (transformers);
79805
79836
 
79806
79837
  ;// ./lib/mdastV6.ts
@@ -84474,7 +84505,7 @@ const variable = (node) => {
84474
84505
  // @note: coming from RDMD, it's set as `variable`. But when mdx is parsed,
84475
84506
  // it's set as `name`
84476
84507
  const name = node.data.hProperties.variable || node.data.hProperties.name;
84477
- return `{user.${name}}`;
84508
+ return name.toString().match(/ /) ? `{user[${JSON.stringify(name)}]}` : `{user.${name}}`;
84478
84509
  };
84479
84510
  /* harmony default export */ const compile_variable = (variable);
84480
84511
 
@@ -84549,7 +84580,7 @@ const mdx_mdx = (tree, _a = {}) => {
84549
84580
 
84550
84581
  const STRIP_TAGS = ['script', 'style'];
84551
84582
  function plain_one(node, opts) {
84552
- var _a, _b;
84583
+ var _a, _b, _c;
84553
84584
  if (node.type === 'comment')
84554
84585
  return '';
84555
84586
  if ('type' in node && node.type === 'text') {
@@ -84558,27 +84589,37 @@ function plain_one(node, opts) {
84558
84589
  if ('tagName' in node) {
84559
84590
  if (STRIP_TAGS.includes(node.tagName))
84560
84591
  return '';
84561
- if (node.tagName === 'html-block') {
84562
- if (!node.properties.html)
84563
- return '';
84564
- return plain_all(lib_hast(node.properties.html.toString()), opts);
84565
- }
84566
- if (node.tagName === 'rdme-callout') {
84567
- const { icon, title } = node.properties;
84568
- const children = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a.slice(title ? 1 : 0);
84569
- const body = children ? plain_all({ type: 'root', children }, opts) : '';
84570
- return [icon, ' ', title, title && body && ': ', body].filter(Boolean).join('');
84571
- }
84572
- if (node.tagName === 'readme-glossary-item') {
84573
- return node.properties.term;
84574
- }
84575
- if (node.tagName === 'readme-variable') {
84576
- const key = node.properties.variable.toString();
84577
- const val = opts.variables[key];
84578
- return val || `<<${key}>>`;
84579
- }
84580
- if (node.tagName === 'img') {
84581
- return ((_b = node.properties) === null || _b === void 0 ? void 0 : _b.title) || '';
84592
+ switch (node.tagName) {
84593
+ case 'html-block': {
84594
+ if (!node.properties.html)
84595
+ return '';
84596
+ return plain_all(lib_hast(node.properties.html.toString()), opts);
84597
+ }
84598
+ case 'rdme-callout': {
84599
+ const { icon, title } = node.properties;
84600
+ const children = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a.slice(title ? 1 : 0);
84601
+ const body = children ? plain_all({ type: 'root', children }, opts) : '';
84602
+ return [icon, ' ', title, title && body && ': ', body].filter(Boolean).join('');
84603
+ }
84604
+ case 'readme-glossary-item': {
84605
+ return node.properties.term;
84606
+ }
84607
+ case 'readme-variable': {
84608
+ const key = node.properties.variable.toString();
84609
+ const val = opts.variables[key];
84610
+ return val || `<<${key}>>`;
84611
+ }
84612
+ case 'img': {
84613
+ return ((_b = node.properties) === null || _b === void 0 ? void 0 : _b.title) || '';
84614
+ }
84615
+ case 'Accordion':
84616
+ case 'Card':
84617
+ case 'Tab': {
84618
+ const title = ((_c = node.properties) === null || _c === void 0 ? void 0 : _c.title) || '';
84619
+ const children = node === null || node === void 0 ? void 0 : node.children;
84620
+ const body = children ? plain_all({ type: 'root', children }, opts) : '';
84621
+ return [title, body].filter(Boolean).join(' ');
84622
+ }
84582
84623
  }
84583
84624
  }
84584
84625
  if ('value' in node) {
@@ -1,12 +1,13 @@
1
+ import compatabilityTransfomer from './compatability';
1
2
  import divTransformer from './div';
2
3
  import injectComponents from './inject-components';
4
+ import mdxToHast from './mdx-to-hast';
5
+ import mermaidTransformer from './mermaid';
3
6
  import readmeComponentsTransformer from './readme-components';
4
7
  import readmeToMdx from './readme-to-mdx';
5
- import variablesTransformer from './variables';
6
8
  import tablesToJsx from './tables-to-jsx';
7
- import compatabilityTransfomer from './compatability';
8
- import mermaidTransformer from './mermaid';
9
- export { compatabilityTransfomer, divTransformer, readmeComponentsTransformer, readmeToMdx, injectComponents, variablesTransformer, tablesToJsx, mermaidTransformer, };
9
+ import variablesTransformer from './variables';
10
+ export { compatabilityTransfomer, divTransformer, injectComponents, mdxToHast, mermaidTransformer, readmeComponentsTransformer, readmeToMdx, tablesToJsx, variablesTransformer, };
10
11
  export declare const defaultTransforms: {
11
12
  calloutTransformer: () => (tree: any) => void;
12
13
  codeTabsTransformer: ({ copyButtons }?: {
@@ -0,0 +1,3 @@
1
+ import { Transform } from 'mdast-util-from-markdown';
2
+ declare const mdxToHast: () => Transform;
3
+ export default mdxToHast;
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.3",
5
+ "version": "7.11.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",