@readme/markdown 6.75.0-beta.61 → 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,25 +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
- };
65885
+ value: `{${node.value}}`,
65886
+ position: node.position,
65887
+ };
65873
65888
  parent.children.splice(index, 1, variable);
65874
65889
  });
65875
65890
  return tree;
@@ -65887,14 +65902,7 @@ const variables = () => tree => {
65887
65902
 
65888
65903
 
65889
65904
 
65890
- /* harmony default export */ const transform = ([
65891
- callouts,
65892
- code_tabs,
65893
- transform_embeds,
65894
- transform_images,
65895
- gemoji_,
65896
- transform_variables,
65897
- ]);
65905
+ /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
65898
65906
 
65899
65907
  ;// CONCATENATED MODULE: ./lib/ast-processor.ts
65900
65908
 
@@ -65906,6 +65914,7 @@ const remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
65906
65914
  const astProcessor = (opts = { components: {} }) => remark()
65907
65915
  .use(remarkMdx)
65908
65916
  .use(remarkPlugins)
65917
+ .use(transform_variables, { asMdx: false })
65909
65918
  .use(readme_components({ components: opts.components }));
65910
65919
  /* harmony default export */ const ast_processor = (astProcessor);
65911
65920
 
@@ -78546,7 +78555,7 @@ var compile_rest = (undefined && undefined.__rest) || function (s, e) {
78546
78555
 
78547
78556
 
78548
78557
 
78549
- const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
78558
+ const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform, transform_variables];
78550
78559
  const compile_compile = (text, _a = {}) => {
78551
78560
  var { components } = _a, opts = compile_rest(_a, ["components"]);
78552
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,25 +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
- };
67338
+ value: `{${node.value}}`,
67339
+ position: node.position,
67340
+ };
67326
67341
  parent.children.splice(index, 1, variable);
67327
67342
  });
67328
67343
  return tree;
@@ -67340,14 +67355,7 @@ const variables = () => tree => {
67340
67355
 
67341
67356
 
67342
67357
 
67343
- /* harmony default export */ const transform = ([
67344
- callouts,
67345
- code_tabs,
67346
- transform_embeds,
67347
- transform_images,
67348
- gemoji_,
67349
- transform_variables,
67350
- ]);
67358
+ /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
67351
67359
 
67352
67360
  ;// CONCATENATED MODULE: ./lib/ast-processor.ts
67353
67361
 
@@ -67359,6 +67367,7 @@ const remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
67359
67367
  const astProcessor = (opts = { components: {} }) => remark()
67360
67368
  .use(remarkMdx)
67361
67369
  .use(remarkPlugins)
67370
+ .use(transform_variables, { asMdx: false })
67362
67371
  .use(readme_components({ components: opts.components }));
67363
67372
  /* harmony default export */ const ast_processor = (astProcessor);
67364
67373
 
@@ -79999,7 +80008,7 @@ var compile_rest = (undefined && undefined.__rest) || function (s, e) {
79999
80008
 
80000
80009
 
80001
80010
 
80002
- const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform];
80011
+ const compile_remarkPlugins = [remarkFrontmatter, remarkGfm, ...transform, transform_variables];
80003
80012
  const compile_compile = (text, _a = {}) => {
80004
80013
  var { components } = _a, opts = compile_rest(_a, ["components"]);
80005
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.61",
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",