@readme/markdown 6.75.0-beta.62 → 6.75.0-beta.63

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
@@ -48474,7 +48474,8 @@ const calloutTransformer = () => {
48474
48474
  ;// CONCATENATED MODULE: ./processor/transform/code-tabs.ts
48475
48475
 
48476
48476
 
48477
- const codeTabsTransformer = () => tree => {
48477
+ const isCode = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'code';
48478
+ const codeTabsTransformer = () => (tree) => {
48478
48479
  visit(tree, 'code', (node) => {
48479
48480
  const { lang, meta, value } = node;
48480
48481
  node.data = {
@@ -48489,7 +48490,7 @@ const codeTabsTransformer = () => tree => {
48489
48490
  let walker = index + 1;
48490
48491
  while (walker <= length) {
48491
48492
  const sibling = parent.children[walker];
48492
- if ((sibling === null || sibling === void 0 ? void 0 : sibling.type) !== 'code')
48493
+ if (!isCode(sibling))
48493
48494
  break;
48494
48495
  const olderSibling = parent.children[walker - 1];
48495
48496
  if (olderSibling.position.end.offset + sibling.position.start.column !== sibling.position.start.offset)
@@ -65851,26 +65852,39 @@ const readmeToMdx = () => tree => {
65851
65852
 
65852
65853
  ;// CONCATENATED MODULE: ./processor/transform/variables.ts
65853
65854
 
65854
- const variables = () => tree => {
65855
+
65856
+ const variables = ({ asMdx } = { asMdx: true }) => tree => {
65855
65857
  visit(tree, (node, index, parent) => {
65856
65858
  if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
65857
65859
  return;
65858
65860
  const match = node.value.match(/^user\.(?<value>.*)$/);
65859
65861
  if (!match)
65860
65862
  return;
65861
- let variable = {
65862
- type: 'mdxJsxTextElement',
65863
- name: 'Variable',
65864
- attributes: [
65865
- {
65866
- type: 'mdxJsxAttribute',
65867
- name: 'name',
65868
- value: match.groups.value,
65863
+ let variable = asMdx
65864
+ ? {
65865
+ type: 'mdxJsxTextElement',
65866
+ name: 'Variable',
65867
+ attributes: [
65868
+ {
65869
+ type: 'mdxJsxAttribute',
65870
+ name: 'name',
65871
+ value: match.groups.value,
65872
+ },
65873
+ ],
65874
+ children: [],
65875
+ position: node.position,
65876
+ }
65877
+ : {
65878
+ type: NodeTypes.variable,
65879
+ data: {
65880
+ hName: 'Variable',
65881
+ hProperties: {
65882
+ name: match.groups.value,
65883
+ },
65869
65884
  },
65870
- ],
65871
- children: [],
65872
- position: node.position,
65873
- };
65885
+ value: `{${node.value}}`,
65886
+ position: node.position,
65887
+ };
65874
65888
  parent.children.splice(index, 1, variable);
65875
65889
  });
65876
65890
  return tree;
@@ -65888,14 +65902,7 @@ const variables = () => tree => {
65888
65902
 
65889
65903
 
65890
65904
 
65891
- /* harmony default export */ const transform = ([
65892
- callouts,
65893
- code_tabs,
65894
- transform_embeds,
65895
- transform_images,
65896
- gemoji_,
65897
- transform_variables,
65898
- ]);
65905
+ /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
65899
65906
 
65900
65907
  ;// CONCATENATED MODULE: ./lib/ast-processor.ts
65901
65908
 
@@ -65907,6 +65914,7 @@ const remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
65907
65914
  const astProcessor = (opts = { components: {} }) => remark()
65908
65915
  .use(remarkMdx)
65909
65916
  .use(remarkPlugins)
65917
+ .use(transform_variables, { asMdx: false })
65910
65918
  .use(readme_components({ components: opts.components }));
65911
65919
  /* harmony default export */ const ast_processor = (astProcessor);
65912
65920
 
@@ -78547,7 +78555,7 @@ var compile_rest = (undefined && undefined.__rest) || function (s, e) {
78547
78555
 
78548
78556
 
78549
78557
 
78550
- const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
78558
+ const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform, transform_variables];
78551
78559
  const compile_compile = (text, _a = {}) => {
78552
78560
  var { components } = _a, opts = compile_rest(_a, ["components"]);
78553
78561
  try {
package/dist/main.node.js CHANGED
@@ -49927,7 +49927,8 @@ const calloutTransformer = () => {
49927
49927
  ;// CONCATENATED MODULE: ./processor/transform/code-tabs.ts
49928
49928
 
49929
49929
 
49930
- const codeTabsTransformer = () => tree => {
49930
+ const isCode = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'code';
49931
+ const codeTabsTransformer = () => (tree) => {
49931
49932
  visit(tree, 'code', (node) => {
49932
49933
  const { lang, meta, value } = node;
49933
49934
  node.data = {
@@ -49942,7 +49943,7 @@ const codeTabsTransformer = () => tree => {
49942
49943
  let walker = index + 1;
49943
49944
  while (walker <= length) {
49944
49945
  const sibling = parent.children[walker];
49945
- if ((sibling === null || sibling === void 0 ? void 0 : sibling.type) !== 'code')
49946
+ if (!isCode(sibling))
49946
49947
  break;
49947
49948
  const olderSibling = parent.children[walker - 1];
49948
49949
  if (olderSibling.position.end.offset + sibling.position.start.column !== sibling.position.start.offset)
@@ -67304,26 +67305,39 @@ const readmeToMdx = () => tree => {
67304
67305
 
67305
67306
  ;// CONCATENATED MODULE: ./processor/transform/variables.ts
67306
67307
 
67307
- const variables = () => tree => {
67308
+
67309
+ const variables = ({ asMdx } = { asMdx: true }) => tree => {
67308
67310
  visit(tree, (node, index, parent) => {
67309
67311
  if (!['mdxFlowExpression', 'mdxTextExpression'].includes(node.type) || !('value' in node))
67310
67312
  return;
67311
67313
  const match = node.value.match(/^user\.(?<value>.*)$/);
67312
67314
  if (!match)
67313
67315
  return;
67314
- let variable = {
67315
- type: 'mdxJsxTextElement',
67316
- name: 'Variable',
67317
- attributes: [
67318
- {
67319
- type: 'mdxJsxAttribute',
67320
- name: 'name',
67321
- value: match.groups.value,
67316
+ let variable = asMdx
67317
+ ? {
67318
+ type: 'mdxJsxTextElement',
67319
+ name: 'Variable',
67320
+ attributes: [
67321
+ {
67322
+ type: 'mdxJsxAttribute',
67323
+ name: 'name',
67324
+ value: match.groups.value,
67325
+ },
67326
+ ],
67327
+ children: [],
67328
+ position: node.position,
67329
+ }
67330
+ : {
67331
+ type: NodeTypes.variable,
67332
+ data: {
67333
+ hName: 'Variable',
67334
+ hProperties: {
67335
+ name: match.groups.value,
67336
+ },
67322
67337
  },
67323
- ],
67324
- children: [],
67325
- position: node.position,
67326
- };
67338
+ value: `{${node.value}}`,
67339
+ position: node.position,
67340
+ };
67327
67341
  parent.children.splice(index, 1, variable);
67328
67342
  });
67329
67343
  return tree;
@@ -67341,14 +67355,7 @@ const variables = () => tree => {
67341
67355
 
67342
67356
 
67343
67357
 
67344
- /* harmony default export */ const transform = ([
67345
- callouts,
67346
- code_tabs,
67347
- transform_embeds,
67348
- transform_images,
67349
- gemoji_,
67350
- transform_variables,
67351
- ]);
67358
+ /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
67352
67359
 
67353
67360
  ;// CONCATENATED MODULE: ./lib/ast-processor.ts
67354
67361
 
@@ -67360,6 +67367,7 @@ const remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
67360
67367
  const astProcessor = (opts = { components: {} }) => remark()
67361
67368
  .use(remarkMdx)
67362
67369
  .use(remarkPlugins)
67370
+ .use(transform_variables, { asMdx: false })
67363
67371
  .use(readme_components({ components: opts.components }));
67364
67372
  /* harmony default export */ const ast_processor = (astProcessor);
67365
67373
 
@@ -80000,7 +80008,7 @@ var compile_rest = (undefined && undefined.__rest) || function (s, e) {
80000
80008
 
80001
80009
 
80002
80010
 
80003
- const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
80011
+ const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform, transform_variables];
80004
80012
  const compile_compile = (text, _a = {}) => {
80005
80013
  var { components } = _a, opts = compile_rest(_a, ["components"]);
80006
80014
  try {
@@ -1,2 +1,3 @@
1
- declare const codeTabsTransformer: () => (tree: any) => any;
1
+ import { Node } from 'mdast';
2
+ declare const codeTabsTransformer: () => (tree: Node) => Node;
2
3
  export default codeTabsTransformer;
@@ -1,3 +1,5 @@
1
1
  import { Transform } from 'mdast-util-from-markdown';
2
- declare const variables: () => Transform;
2
+ declare const variables: ({ asMdx }?: {
3
+ asMdx: boolean;
4
+ }) => Transform;
3
5
  export default variables;
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.62",
5
+ "version": "6.75.0-beta.63",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",