@readme/markdown 15.2.0 → 15.2.1

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
@@ -11423,7 +11423,7 @@ module.exports = function () {
11423
11423
 
11424
11424
  /***/ },
11425
11425
 
11426
- /***/ 8071
11426
+ /***/ 5168
11427
11427
  (module, __webpack_exports__, __webpack_require__) {
11428
11428
 
11429
11429
  "use strict";
@@ -101458,27 +101458,6 @@ const mdastV6 = (doc, { rdmd }) => {
101458
101458
  };
101459
101459
  /* harmony default export */ const lib_mdastV6 = (mdastV6);
101460
101460
 
101461
- ;// ./processor/compile/anchor.ts
101462
-
101463
-
101464
- const anchor_anchor = (node) => {
101465
- const { href, label, target, title } = getHProps(node);
101466
- const attrs = {
101467
- ...(label && { label }),
101468
- ...(target && { target }),
101469
- href: href ?? '',
101470
- ...(title && { title }),
101471
- };
101472
- // Serialize children (phrasing content) back to markdown
101473
- // Wrap in paragraph to satisfy RootContent type requirement
101474
- const children = toMarkdown({
101475
- type: 'paragraph',
101476
- children: node.children,
101477
- }).trim();
101478
- return `<Anchor ${formatProps(attrs)}>${children}</Anchor>`;
101479
- };
101480
- /* harmony default export */ const compile_anchor = (anchor_anchor);
101481
-
101482
101461
  ;// ./processor/compile/callout.ts
101483
101462
 
101484
101463
  const callout = (node, _, state, info) => {
@@ -101636,7 +101615,6 @@ const compile_text_text = (node, parent, state, info) => {
101636
101615
 
101637
101616
 
101638
101617
 
101639
-
101640
101618
  function compilers(mdxish = false) {
101641
101619
  const data = this.data();
101642
101620
  const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
@@ -101656,7 +101634,6 @@ function compilers(mdxish = false) {
101656
101634
  plain: compile_plain,
101657
101635
  yaml: compile_compatibility,
101658
101636
  // needed only for mdxish
101659
- ...(mdxish && { [NodeTypes.anchor]: compile_anchor }),
101660
101637
  ...(mdxish && { list: compile_list }),
101661
101638
  ...(mdxish && { listItem: list_item }),
101662
101639
  ...(mdxish && { text: compile_text }),
@@ -103541,6 +103518,39 @@ const mdxComponentHandlers = {
103541
103518
  [NodeTypes.htmlBlock]: htmlBlockHandler,
103542
103519
  };
103543
103520
 
103521
+ ;// ./processor/transform/mdxish/anchor-to-jsx.ts
103522
+
103523
+
103524
+
103525
+ /**
103526
+ * Serializes mdxish anchors to JSX `<Anchor>` syntax. Handing the node to
103527
+ * `mdast-util-mdx-jsx` runs the label through the document's own serializer
103528
+ * state, so readme nodes (variables, emoji, glossary) reach their handlers.
103529
+ */
103530
+ const mdxishAnchorToJsx = () => tree => {
103531
+ visit(tree, NodeTypes.anchor, (node, index, parent) => {
103532
+ if (!parent || index === undefined)
103533
+ return;
103534
+ const { href, label, target, title } = getHProps(node);
103535
+ const jsx = {
103536
+ type: 'mdxJsxTextElement',
103537
+ name: 'Anchor',
103538
+ // An anchor always renders an `href`, even an empty one, so it's built
103539
+ // directly rather than through `toAttributes`, which drops empty values.
103540
+ attributes: [
103541
+ ...toAttributes({ label, target }),
103542
+ { type: 'mdxJsxAttribute', name: 'href', value: href ?? '' },
103543
+ ...toAttributes({ title }),
103544
+ ],
103545
+ children: node.children,
103546
+ position: node.position,
103547
+ };
103548
+ parent.children[index] = jsx;
103549
+ });
103550
+ return tree;
103551
+ };
103552
+ /* harmony default export */ const anchor_to_jsx = (mdxishAnchorToJsx);
103553
+
103544
103554
  ;// ./processor/transform/mdxish/callout-to-jsx.ts
103545
103555
 
103546
103556
 
@@ -107641,6 +107651,7 @@ function loadComponents() {
107641
107651
 
107642
107652
 
107643
107653
 
107654
+
107644
107655
 
107645
107656
 
107646
107657
  const defaultTransformers = [
@@ -107743,6 +107754,7 @@ function mdxishMdastToMd(mdast) {
107743
107754
  .use(remarkGfm)
107744
107755
  .use(callout_to_jsx)
107745
107756
  .use(mdxish_tables_to_jsx)
107757
+ .use(anchor_to_jsx)
107746
107758
  .use(mdxishCompilers)
107747
107759
  .use(mdxJsxStringify)
107748
107760
  .use(remarkStringify, {
@@ -108764,7 +108776,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"*":["about","acceptCharset","accessK
108764
108776
  /******/ // startup
108765
108777
  /******/ // Load entry module and return exports
108766
108778
  /******/ // This entry module used 'module' so it can't be inlined
108767
- /******/ let __webpack_exports__ = __webpack_require__(8071);
108779
+ /******/ let __webpack_exports__ = __webpack_require__(5168);
108768
108780
  /******/
108769
108781
  /******/ return __webpack_exports__;
108770
108782
  /******/ })()
package/dist/main.node.js CHANGED
@@ -19045,7 +19045,7 @@ module.exports = function () {
19045
19045
 
19046
19046
  /***/ },
19047
19047
 
19048
- /***/ 4359
19048
+ /***/ 5814
19049
19049
  (module, __webpack_exports__, __webpack_require__) {
19050
19050
 
19051
19051
  "use strict";
@@ -121641,27 +121641,6 @@ const mdastV6 = (doc, { rdmd }) => {
121641
121641
  };
121642
121642
  /* harmony default export */ const lib_mdastV6 = (mdastV6);
121643
121643
 
121644
- ;// ./processor/compile/anchor.ts
121645
-
121646
-
121647
- const anchor_anchor = (node) => {
121648
- const { href, label, target, title } = getHProps(node);
121649
- const attrs = {
121650
- ...(label && { label }),
121651
- ...(target && { target }),
121652
- href: href ?? '',
121653
- ...(title && { title }),
121654
- };
121655
- // Serialize children (phrasing content) back to markdown
121656
- // Wrap in paragraph to satisfy RootContent type requirement
121657
- const children = toMarkdown({
121658
- type: 'paragraph',
121659
- children: node.children,
121660
- }).trim();
121661
- return `<Anchor ${formatProps(attrs)}>${children}</Anchor>`;
121662
- };
121663
- /* harmony default export */ const compile_anchor = (anchor_anchor);
121664
-
121665
121644
  ;// ./processor/compile/callout.ts
121666
121645
 
121667
121646
  const callout = (node, _, state, info) => {
@@ -121819,7 +121798,6 @@ const compile_text_text = (node, parent, state, info) => {
121819
121798
 
121820
121799
 
121821
121800
 
121822
-
121823
121801
  function compilers(mdxish = false) {
121824
121802
  const data = this.data();
121825
121803
  const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
@@ -121839,7 +121817,6 @@ function compilers(mdxish = false) {
121839
121817
  plain: compile_plain,
121840
121818
  yaml: compile_compatibility,
121841
121819
  // needed only for mdxish
121842
- ...(mdxish && { [NodeTypes.anchor]: compile_anchor }),
121843
121820
  ...(mdxish && { list: compile_list }),
121844
121821
  ...(mdxish && { listItem: list_item }),
121845
121822
  ...(mdxish && { text: compile_text }),
@@ -123724,6 +123701,39 @@ const mdxComponentHandlers = {
123724
123701
  [NodeTypes.htmlBlock]: htmlBlockHandler,
123725
123702
  };
123726
123703
 
123704
+ ;// ./processor/transform/mdxish/anchor-to-jsx.ts
123705
+
123706
+
123707
+
123708
+ /**
123709
+ * Serializes mdxish anchors to JSX `<Anchor>` syntax. Handing the node to
123710
+ * `mdast-util-mdx-jsx` runs the label through the document's own serializer
123711
+ * state, so readme nodes (variables, emoji, glossary) reach their handlers.
123712
+ */
123713
+ const mdxishAnchorToJsx = () => tree => {
123714
+ visit(tree, NodeTypes.anchor, (node, index, parent) => {
123715
+ if (!parent || index === undefined)
123716
+ return;
123717
+ const { href, label, target, title } = getHProps(node);
123718
+ const jsx = {
123719
+ type: 'mdxJsxTextElement',
123720
+ name: 'Anchor',
123721
+ // An anchor always renders an `href`, even an empty one, so it's built
123722
+ // directly rather than through `toAttributes`, which drops empty values.
123723
+ attributes: [
123724
+ ...toAttributes({ label, target }),
123725
+ { type: 'mdxJsxAttribute', name: 'href', value: href ?? '' },
123726
+ ...toAttributes({ title }),
123727
+ ],
123728
+ children: node.children,
123729
+ position: node.position,
123730
+ };
123731
+ parent.children[index] = jsx;
123732
+ });
123733
+ return tree;
123734
+ };
123735
+ /* harmony default export */ const anchor_to_jsx = (mdxishAnchorToJsx);
123736
+
123727
123737
  ;// ./processor/transform/mdxish/callout-to-jsx.ts
123728
123738
 
123729
123739
 
@@ -127824,6 +127834,7 @@ function loadComponents() {
127824
127834
 
127825
127835
 
127826
127836
 
127837
+
127827
127838
 
127828
127839
 
127829
127840
  const defaultTransformers = [
@@ -127926,6 +127937,7 @@ function mdxishMdastToMd(mdast) {
127926
127937
  .use(remarkGfm)
127927
127938
  .use(callout_to_jsx)
127928
127939
  .use(mdxish_tables_to_jsx)
127940
+ .use(anchor_to_jsx)
127929
127941
  .use(mdxishCompilers)
127930
127942
  .use(mdxJsxStringify)
127931
127943
  .use(remarkStringify, {
@@ -129006,7 +129018,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"*":["about","acceptCharset","accessK
129006
129018
  /******/ // startup
129007
129019
  /******/ // Load entry module and return exports
129008
129020
  /******/ // This entry module used 'module' so it can't be inlined
129009
- /******/ let __webpack_exports__ = __webpack_require__(4359);
129021
+ /******/ let __webpack_exports__ = __webpack_require__(5814);
129010
129022
  /******/ module.exports = __webpack_exports__;
129011
129023
  /******/
129012
129024
  /******/ })()