@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 +37 -25
- package/dist/main.node.js +37 -25
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/anchor-to-jsx.d.ts +8 -0
- package/dist/render-fixture.node.js +42 -25
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
- package/dist/processor/compile/anchor.d.ts +0 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Transform } from 'mdast-util-from-markdown';
|
|
2
|
+
/**
|
|
3
|
+
* Serializes mdxish anchors to JSX `<Anchor>` syntax. Handing the node to
|
|
4
|
+
* `mdast-util-mdx-jsx` runs the label through the document's own serializer
|
|
5
|
+
* state, so readme nodes (variables, emoji, glossary) reach their handlers.
|
|
6
|
+
*/
|
|
7
|
+
declare const mdxishAnchorToJsx: () => Transform;
|
|
8
|
+
export default mdxishAnchorToJsx;
|
|
@@ -19045,7 +19045,7 @@ module.exports = function () {
|
|
|
19045
19045
|
|
|
19046
19046
|
/***/ },
|
|
19047
19047
|
|
|
19048
|
-
/***/
|
|
19048
|
+
/***/ 345
|
|
19049
19049
|
(module, __webpack_exports__, __webpack_require__) {
|
|
19050
19050
|
|
|
19051
19051
|
"use strict";
|
|
@@ -121415,27 +121415,6 @@ function htmlToMarkdown(html) {
|
|
|
121415
121415
|
return processor.processSync(html).toString().trim();
|
|
121416
121416
|
}
|
|
121417
121417
|
|
|
121418
|
-
;// ./processor/compile/anchor.ts
|
|
121419
|
-
|
|
121420
|
-
|
|
121421
|
-
const anchor_anchor = (node) => {
|
|
121422
|
-
const { href, label, target, title } = getHProps(node);
|
|
121423
|
-
const attrs = {
|
|
121424
|
-
...(label && { label }),
|
|
121425
|
-
...(target && { target }),
|
|
121426
|
-
href: href ?? '',
|
|
121427
|
-
...(title && { title }),
|
|
121428
|
-
};
|
|
121429
|
-
// Serialize children (phrasing content) back to markdown
|
|
121430
|
-
// Wrap in paragraph to satisfy RootContent type requirement
|
|
121431
|
-
const children = toMarkdown({
|
|
121432
|
-
type: 'paragraph',
|
|
121433
|
-
children: node.children,
|
|
121434
|
-
}).trim();
|
|
121435
|
-
return `<Anchor ${formatProps(attrs)}>${children}</Anchor>`;
|
|
121436
|
-
};
|
|
121437
|
-
/* harmony default export */ const compile_anchor = (anchor_anchor);
|
|
121438
|
-
|
|
121439
121418
|
;// ./processor/compile/callout.ts
|
|
121440
121419
|
|
|
121441
121420
|
const callout = (node, _, state, info) => {
|
|
@@ -121593,7 +121572,6 @@ const compile_text_text = (node, parent, state, info) => {
|
|
|
121593
121572
|
|
|
121594
121573
|
|
|
121595
121574
|
|
|
121596
|
-
|
|
121597
121575
|
function compilers(mdxish = false) {
|
|
121598
121576
|
const data = this.data();
|
|
121599
121577
|
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
@@ -121613,7 +121591,6 @@ function compilers(mdxish = false) {
|
|
|
121613
121591
|
plain: compile_plain,
|
|
121614
121592
|
yaml: compile_compatibility,
|
|
121615
121593
|
// needed only for mdxish
|
|
121616
|
-
...(mdxish && { [NodeTypes.anchor]: compile_anchor }),
|
|
121617
121594
|
...(mdxish && { list: compile_list }),
|
|
121618
121595
|
...(mdxish && { listItem: list_item }),
|
|
121619
121596
|
...(mdxish && { text: compile_text }),
|
|
@@ -122078,6 +122055,43 @@ const mdxComponentHandlers = {
|
|
|
122078
122055
|
[NodeTypes.htmlBlock]: htmlBlockHandler,
|
|
122079
122056
|
};
|
|
122080
122057
|
|
|
122058
|
+
;// ./processor/transform/mdxish/anchor-to-jsx.ts
|
|
122059
|
+
/* unused harmony import specifier */ var anchor_to_jsx_visit;
|
|
122060
|
+
/* unused harmony import specifier */ var anchor_to_jsx_NodeTypes;
|
|
122061
|
+
/* unused harmony import specifier */ var anchor_to_jsx_getHProps;
|
|
122062
|
+
/* unused harmony import specifier */ var anchor_to_jsx_toAttributes;
|
|
122063
|
+
|
|
122064
|
+
|
|
122065
|
+
|
|
122066
|
+
/**
|
|
122067
|
+
* Serializes mdxish anchors to JSX `<Anchor>` syntax. Handing the node to
|
|
122068
|
+
* `mdast-util-mdx-jsx` runs the label through the document's own serializer
|
|
122069
|
+
* state, so readme nodes (variables, emoji, glossary) reach their handlers.
|
|
122070
|
+
*/
|
|
122071
|
+
const mdxishAnchorToJsx = () => tree => {
|
|
122072
|
+
anchor_to_jsx_visit(tree, anchor_to_jsx_NodeTypes.anchor, (node, index, parent) => {
|
|
122073
|
+
if (!parent || index === undefined)
|
|
122074
|
+
return;
|
|
122075
|
+
const { href, label, target, title } = anchor_to_jsx_getHProps(node);
|
|
122076
|
+
const jsx = {
|
|
122077
|
+
type: 'mdxJsxTextElement',
|
|
122078
|
+
name: 'Anchor',
|
|
122079
|
+
// An anchor always renders an `href`, even an empty one, so it's built
|
|
122080
|
+
// directly rather than through `toAttributes`, which drops empty values.
|
|
122081
|
+
attributes: [
|
|
122082
|
+
...anchor_to_jsx_toAttributes({ label, target }),
|
|
122083
|
+
{ type: 'mdxJsxAttribute', name: 'href', value: href ?? '' },
|
|
122084
|
+
...anchor_to_jsx_toAttributes({ title }),
|
|
122085
|
+
],
|
|
122086
|
+
children: node.children,
|
|
122087
|
+
position: node.position,
|
|
122088
|
+
};
|
|
122089
|
+
parent.children[index] = jsx;
|
|
122090
|
+
});
|
|
122091
|
+
return tree;
|
|
122092
|
+
};
|
|
122093
|
+
/* harmony default export */ const anchor_to_jsx = ((/* unused pure expression or super */ null && (mdxishAnchorToJsx)));
|
|
122094
|
+
|
|
122081
122095
|
;// ./processor/transform/mdxish/callout-to-jsx.ts
|
|
122082
122096
|
/* unused harmony import specifier */ var callout_to_jsx_visit;
|
|
122083
122097
|
/* unused harmony import specifier */ var callout_to_jsx_defaultIcons;
|
|
@@ -127510,6 +127524,7 @@ function loadComponents() {
|
|
|
127510
127524
|
/* unused harmony import specifier */ var mdxish_unified;
|
|
127511
127525
|
/* unused harmony import specifier */ var mdxish_mdxishCompilers;
|
|
127512
127526
|
/* unused harmony import specifier */ var mdxish_DEFAULT_BULLET;
|
|
127527
|
+
/* unused harmony import specifier */ var mdxish_mdxishAnchorToJsx;
|
|
127513
127528
|
/* unused harmony import specifier */ var mdxish_mdxishCalloutToJsx;
|
|
127514
127529
|
/* unused harmony import specifier */ var mdxish_mdxishTablesToJsx;
|
|
127515
127530
|
|
|
@@ -127564,6 +127579,7 @@ function loadComponents() {
|
|
|
127564
127579
|
|
|
127565
127580
|
|
|
127566
127581
|
|
|
127582
|
+
|
|
127567
127583
|
|
|
127568
127584
|
|
|
127569
127585
|
const defaultTransformers = [
|
|
@@ -127666,6 +127682,7 @@ function mdxishMdastToMd(mdast) {
|
|
|
127666
127682
|
.use(mdxish_remarkGfm)
|
|
127667
127683
|
.use(mdxish_mdxishCalloutToJsx)
|
|
127668
127684
|
.use(mdxish_mdxishTablesToJsx)
|
|
127685
|
+
.use(mdxish_mdxishAnchorToJsx)
|
|
127669
127686
|
.use(mdxish_mdxishCompilers)
|
|
127670
127687
|
.use(mdxJsxStringify)
|
|
127671
127688
|
.use(mdxish_remarkStringify, {
|
|
@@ -128791,7 +128808,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"*":["about","acceptCharset","accessK
|
|
|
128791
128808
|
/******/ // startup
|
|
128792
128809
|
/******/ // Load entry module and return exports
|
|
128793
128810
|
/******/ // This entry module used 'module' so it can't be inlined
|
|
128794
|
-
/******/ let __webpack_exports__ = __webpack_require__(
|
|
128811
|
+
/******/ let __webpack_exports__ = __webpack_require__(345);
|
|
128795
128812
|
/******/ module.exports = __webpack_exports__;
|
|
128796
128813
|
/******/
|
|
128797
128814
|
/******/ })()
|