@readme/markdown 6.75.0-beta.69 → 6.75.0-beta.70

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
@@ -65698,6 +65698,39 @@ const gemojiTransformer = () => (tree) => {
65698
65698
  };
65699
65699
  /* harmony default export */ const gemoji_ = (gemojiTransformer);
65700
65700
 
65701
+ ;// CONCATENATED MODULE: ./processor/transform/div.ts
65702
+ var div_rest = (undefined && undefined.__rest) || function (s, e) {
65703
+ var t = {};
65704
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
65705
+ t[p] = s[p];
65706
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
65707
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
65708
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
65709
+ t[p[i]] = s[p[i]];
65710
+ }
65711
+ return t;
65712
+ };
65713
+
65714
+
65715
+ const divTransformer = () => tree => {
65716
+ visit(tree, 'div', (node, index, parent) => {
65717
+ var _a;
65718
+ const type = (_a = node.data) === null || _a === void 0 ? void 0 : _a.hName;
65719
+ switch (type) {
65720
+ // Check if the div is a tutorial-tile in disguise
65721
+ case NodeTypes.tutorialTile:
65722
+ const _b = node.data, { hName, hProperties } = _b, rest = div_rest(_b, ["hName", "hProperties"]);
65723
+ const tile = Object.assign(Object.assign({}, rest), { type: NodeTypes.tutorialTile });
65724
+ parent.children.splice(index, 1, tile);
65725
+ // idk what this is and/or just make it a paragraph
65726
+ default:
65727
+ node.type = type || 'paragraph';
65728
+ }
65729
+ });
65730
+ return tree;
65731
+ };
65732
+ /* harmony default export */ const div = (divTransformer);
65733
+
65701
65734
  ;// CONCATENATED MODULE: ./processor/transform/inject-components.ts
65702
65735
 
65703
65736
 
@@ -65850,6 +65883,11 @@ const readmeComponents = (opts) => () => tree => {
65850
65883
 
65851
65884
 
65852
65885
  const readmeToMdx = () => tree => {
65886
+ // Unwrap pinned nodes, replace rdme-pin with its child node
65887
+ visit(tree, 'rdme-pin', (node, i, parent) => {
65888
+ const newNode = node.children[0];
65889
+ parent.children.splice(i, 1, newNode);
65890
+ });
65853
65891
  visit(tree, NodeTypes.tutorialTile, (tile, index, parent) => {
65854
65892
  const attributes = ['backgroundColor', 'emoji', 'id', 'link', 'slug', 'title'].map(name => {
65855
65893
  const value = tile[name];
@@ -65923,7 +65961,8 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
65923
65961
 
65924
65962
 
65925
65963
 
65926
- /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
65964
+
65965
+ /* harmony default export */ const transform = ([callouts, code_tabs, div, transform_embeds, transform_images, gemoji_]);
65927
65966
 
65928
65967
  ;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
65929
65968
  // This module is generated by `script/`.
@@ -94467,6 +94506,10 @@ const compatibility = (node) => {
94467
94506
  return figureToImageBlock(node);
94468
94507
  case 'embed':
94469
94508
  return embedToEmbedBlock(node);
94509
+ case 'i':
94510
+ return `:${node.data.hProperties.className[1]}:`;
94511
+ case 'yaml':
94512
+ return `---\n${node.value}\n---`;
94470
94513
  default:
94471
94514
  throw new Error('Unhandled node type!');
94472
94515
  }
@@ -94504,6 +94547,8 @@ function compilers() {
94504
94547
  escape: compile_compatibility,
94505
94548
  figure: compile_compatibility,
94506
94549
  html: compile_compatibility,
94550
+ i: compile_compatibility,
94551
+ yaml: compile_compatibility,
94507
94552
  };
94508
94553
  toMarkdownExtensions.push({ extensions: [{ handlers }] });
94509
94554
  }
@@ -94517,11 +94562,13 @@ function compilers() {
94517
94562
 
94518
94563
 
94519
94564
 
94565
+
94520
94566
  const mdx_mdx = (tree, { hast = false } = {}) => {
94521
94567
  const processor = unified()
94522
94568
  .use(hast ? rehypeRemark : undefined)
94523
94569
  .use(remarkMdx)
94524
94570
  .use(remarkGfm)
94571
+ .use(transform)
94525
94572
  .use(readme_to_mdx)
94526
94573
  .use(remarkStringify)
94527
94574
  .use(processor_compile);
package/dist/main.node.js CHANGED
@@ -67151,6 +67151,39 @@ const gemojiTransformer = () => (tree) => {
67151
67151
  };
67152
67152
  /* harmony default export */ const gemoji_ = (gemojiTransformer);
67153
67153
 
67154
+ ;// CONCATENATED MODULE: ./processor/transform/div.ts
67155
+ var div_rest = (undefined && undefined.__rest) || function (s, e) {
67156
+ var t = {};
67157
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
67158
+ t[p] = s[p];
67159
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
67160
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
67161
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
67162
+ t[p[i]] = s[p[i]];
67163
+ }
67164
+ return t;
67165
+ };
67166
+
67167
+
67168
+ const divTransformer = () => tree => {
67169
+ visit(tree, 'div', (node, index, parent) => {
67170
+ var _a;
67171
+ const type = (_a = node.data) === null || _a === void 0 ? void 0 : _a.hName;
67172
+ switch (type) {
67173
+ // Check if the div is a tutorial-tile in disguise
67174
+ case NodeTypes.tutorialTile:
67175
+ const _b = node.data, { hName, hProperties } = _b, rest = div_rest(_b, ["hName", "hProperties"]);
67176
+ const tile = Object.assign(Object.assign({}, rest), { type: NodeTypes.tutorialTile });
67177
+ parent.children.splice(index, 1, tile);
67178
+ // idk what this is and/or just make it a paragraph
67179
+ default:
67180
+ node.type = type || 'paragraph';
67181
+ }
67182
+ });
67183
+ return tree;
67184
+ };
67185
+ /* harmony default export */ const transform_div = (divTransformer);
67186
+
67154
67187
  ;// CONCATENATED MODULE: ./processor/transform/inject-components.ts
67155
67188
 
67156
67189
 
@@ -67303,6 +67336,11 @@ const readmeComponents = (opts) => () => tree => {
67303
67336
 
67304
67337
 
67305
67338
  const readmeToMdx = () => tree => {
67339
+ // Unwrap pinned nodes, replace rdme-pin with its child node
67340
+ visit(tree, 'rdme-pin', (node, i, parent) => {
67341
+ const newNode = node.children[0];
67342
+ parent.children.splice(i, 1, newNode);
67343
+ });
67306
67344
  visit(tree, NodeTypes.tutorialTile, (tile, index, parent) => {
67307
67345
  const attributes = ['backgroundColor', 'emoji', 'id', 'link', 'slug', 'title'].map(name => {
67308
67346
  const value = tile[name];
@@ -67376,7 +67414,8 @@ const variables = ({ asMdx } = { asMdx: true }) => tree => {
67376
67414
 
67377
67415
 
67378
67416
 
67379
- /* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
67417
+
67418
+ /* harmony default export */ const transform = ([callouts, code_tabs, transform_div, transform_embeds, transform_images, gemoji_]);
67380
67419
 
67381
67420
  ;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
67382
67421
  // This module is generated by `script/`.
@@ -95920,6 +95959,10 @@ const compatibility = (node) => {
95920
95959
  return figureToImageBlock(node);
95921
95960
  case 'embed':
95922
95961
  return embedToEmbedBlock(node);
95962
+ case 'i':
95963
+ return `:${node.data.hProperties.className[1]}:`;
95964
+ case 'yaml':
95965
+ return `---\n${node.value}\n---`;
95923
95966
  default:
95924
95967
  throw new Error('Unhandled node type!');
95925
95968
  }
@@ -95957,6 +96000,8 @@ function compilers() {
95957
96000
  escape: compile_compatibility,
95958
96001
  figure: compile_compatibility,
95959
96002
  html: compile_compatibility,
96003
+ i: compile_compatibility,
96004
+ yaml: compile_compatibility,
95960
96005
  };
95961
96006
  toMarkdownExtensions.push({ extensions: [{ handlers }] });
95962
96007
  }
@@ -95970,11 +96015,13 @@ function compilers() {
95970
96015
 
95971
96016
 
95972
96017
 
96018
+
95973
96019
  const mdx_mdx = (tree, { hast = false } = {}) => {
95974
96020
  const processor = unified()
95975
96021
  .use(hast ? rehypeRemark : undefined)
95976
96022
  .use(remarkMdx)
95977
96023
  .use(remarkGfm)
96024
+ .use(transform)
95978
96025
  .use(readme_to_mdx)
95979
96026
  .use(remarkStringify)
95980
96027
  .use(processor_compile);
@@ -38,6 +38,16 @@ type CompatNodes = {
38
38
  value: string;
39
39
  }];
40
40
  }];
41
+ } | {
42
+ type: 'i';
43
+ data: {
44
+ hProperties: {
45
+ className: string[];
46
+ };
47
+ };
48
+ } | {
49
+ type: 'yaml';
50
+ value: string;
41
51
  } | Html;
42
52
  declare const compatibility: (node: CompatNodes) => string;
43
53
  export default compatibility;
@@ -0,0 +1,3 @@
1
+ import { Transform } from 'mdast-util-from-markdown';
2
+ declare const divTransformer: () => Transform;
3
+ export default divTransformer;
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.69",
5
+ "version": "6.75.0-beta.70",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",