@readme/markdown 7.6.0 → 7.6.2
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
|
@@ -65297,7 +65297,7 @@ const readmeToMdx = () => tree => {
|
|
|
65297
65297
|
parent.children.splice(index, 1, {
|
|
65298
65298
|
type: 'mdxJsxFlowElement',
|
|
65299
65299
|
name: 'Image',
|
|
65300
|
-
attributes: toAttributes(Object.assign(Object.assign({}, image), { src: image.src || image.url }), imageAttrs),
|
|
65300
|
+
attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
|
|
65301
65301
|
children: caption.children,
|
|
65302
65302
|
});
|
|
65303
65303
|
});
|
|
@@ -65419,6 +65419,11 @@ const visitor = (table, index, parent) => {
|
|
|
65419
65419
|
const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
|
|
65420
65420
|
? cell.children[0].children[0]
|
|
65421
65421
|
: cell.children[0];
|
|
65422
|
+
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
65423
|
+
// transformer, but then there'd be some duplication.
|
|
65424
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
65425
|
+
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
65426
|
+
});
|
|
65422
65427
|
if (!phrasing(content)) {
|
|
65423
65428
|
hasFlowContent = true;
|
|
65424
65429
|
return EXIT;
|
|
@@ -65483,6 +65488,25 @@ const tablesToJsx = () => tree => {
|
|
|
65483
65488
|
};
|
|
65484
65489
|
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
65485
65490
|
|
|
65491
|
+
;// CONCATENATED MODULE: ./processor/transform/compatability.ts
|
|
65492
|
+
|
|
65493
|
+
const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
65494
|
+
const compatibilityTransfomer = () => tree => {
|
|
65495
|
+
const trimEmphasis = (node) => {
|
|
65496
|
+
visit(node, 'text', child => {
|
|
65497
|
+
child.value = child.value.trim();
|
|
65498
|
+
return EXIT;
|
|
65499
|
+
});
|
|
65500
|
+
return node;
|
|
65501
|
+
};
|
|
65502
|
+
visit(tree, strongTest, node => {
|
|
65503
|
+
trimEmphasis(node);
|
|
65504
|
+
return SKIP;
|
|
65505
|
+
});
|
|
65506
|
+
return tree;
|
|
65507
|
+
};
|
|
65508
|
+
/* harmony default export */ const compatability = (compatibilityTransfomer);
|
|
65509
|
+
|
|
65486
65510
|
;// CONCATENATED MODULE: ./processor/transform/index.ts
|
|
65487
65511
|
|
|
65488
65512
|
|
|
@@ -65496,6 +65520,7 @@ const tablesToJsx = () => tree => {
|
|
|
65496
65520
|
|
|
65497
65521
|
|
|
65498
65522
|
|
|
65523
|
+
|
|
65499
65524
|
/* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
|
|
65500
65525
|
|
|
65501
65526
|
;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
|
|
@@ -82709,6 +82734,10 @@ const callout = (node, _, state, info) => {
|
|
|
82709
82734
|
const tracker = state.createTracker(info);
|
|
82710
82735
|
tracker.move('> ');
|
|
82711
82736
|
tracker.shift(2);
|
|
82737
|
+
// @note: compatability
|
|
82738
|
+
if (node.data.hProperties.title === '') {
|
|
82739
|
+
node.children.unshift({ type: 'paragraph', children: [{ type: 'text', value: '' }] });
|
|
82740
|
+
}
|
|
82712
82741
|
const map = (line, index, blank) => {
|
|
82713
82742
|
return `>${index === 0 ? ` ${node.data.hProperties.icon}` : ''}${blank ? '' : ' '}${line}`;
|
|
82714
82743
|
};
|
|
@@ -93909,7 +93938,7 @@ const compatibility_html = (node) => {
|
|
|
93909
93938
|
return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
|
|
93910
93939
|
};
|
|
93911
93940
|
const figureToImageBlock = (node) => {
|
|
93912
|
-
const _a = node.children.find((child) => child.type === 'image'), { align, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "url", "alt", "title"]);
|
|
93941
|
+
const _a = node.children.find((child) => child.type === 'image'), { align, border, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "border", "width", "src", "url", "alt", "title"]);
|
|
93913
93942
|
const { className } = image.data.hProperties;
|
|
93914
93943
|
const figcaption = node.children.find((child) => child.type === 'figcaption');
|
|
93915
93944
|
const caption = figcaption
|
|
@@ -93918,7 +93947,7 @@ const figureToImageBlock = (node) => {
|
|
|
93918
93947
|
children: figcaption.children,
|
|
93919
93948
|
}).trim()
|
|
93920
93949
|
: null;
|
|
93921
|
-
const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
|
|
93950
|
+
const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (border && { border })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
|
|
93922
93951
|
return `<Image ${formatProps(attributes)} />`;
|
|
93923
93952
|
};
|
|
93924
93953
|
const embedToEmbedBlock = (node) => {
|
|
@@ -94022,6 +94051,7 @@ const mdx_mdx = (tree, _a = {}) => {
|
|
|
94022
94051
|
.use(div)
|
|
94023
94052
|
.use(readme_to_mdx)
|
|
94024
94053
|
.use(tables_to_jsx)
|
|
94054
|
+
.use(compatability)
|
|
94025
94055
|
.use(processor_compile)
|
|
94026
94056
|
.use(remarkStringify, opts);
|
|
94027
94057
|
return processor.stringify(processor.runSync(tree));
|
package/dist/main.node.js
CHANGED
|
@@ -66284,7 +66284,7 @@ const readmeToMdx = () => tree => {
|
|
|
66284
66284
|
parent.children.splice(index, 1, {
|
|
66285
66285
|
type: 'mdxJsxFlowElement',
|
|
66286
66286
|
name: 'Image',
|
|
66287
|
-
attributes: toAttributes(Object.assign(Object.assign({}, image), { src: image.src || image.url }), imageAttrs),
|
|
66287
|
+
attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
|
|
66288
66288
|
children: caption.children,
|
|
66289
66289
|
});
|
|
66290
66290
|
});
|
|
@@ -66406,6 +66406,11 @@ const visitor = (table, index, parent) => {
|
|
|
66406
66406
|
const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
|
|
66407
66407
|
? cell.children[0].children[0]
|
|
66408
66408
|
: cell.children[0];
|
|
66409
|
+
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
66410
|
+
// transformer, but then there'd be some duplication.
|
|
66411
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
66412
|
+
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
66413
|
+
});
|
|
66409
66414
|
if (!phrasing(content)) {
|
|
66410
66415
|
hasFlowContent = true;
|
|
66411
66416
|
return EXIT;
|
|
@@ -66470,6 +66475,25 @@ const tablesToJsx = () => tree => {
|
|
|
66470
66475
|
};
|
|
66471
66476
|
/* harmony default export */ const tables_to_jsx = (tablesToJsx);
|
|
66472
66477
|
|
|
66478
|
+
;// CONCATENATED MODULE: ./processor/transform/compatability.ts
|
|
66479
|
+
|
|
66480
|
+
const strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
66481
|
+
const compatibilityTransfomer = () => tree => {
|
|
66482
|
+
const trimEmphasis = (node) => {
|
|
66483
|
+
visit(node, 'text', child => {
|
|
66484
|
+
child.value = child.value.trim();
|
|
66485
|
+
return EXIT;
|
|
66486
|
+
});
|
|
66487
|
+
return node;
|
|
66488
|
+
};
|
|
66489
|
+
visit(tree, strongTest, node => {
|
|
66490
|
+
trimEmphasis(node);
|
|
66491
|
+
return SKIP;
|
|
66492
|
+
});
|
|
66493
|
+
return tree;
|
|
66494
|
+
};
|
|
66495
|
+
/* harmony default export */ const compatability = (compatibilityTransfomer);
|
|
66496
|
+
|
|
66473
66497
|
;// CONCATENATED MODULE: ./processor/transform/index.ts
|
|
66474
66498
|
|
|
66475
66499
|
|
|
@@ -66483,6 +66507,7 @@ const tablesToJsx = () => tree => {
|
|
|
66483
66507
|
|
|
66484
66508
|
|
|
66485
66509
|
|
|
66510
|
+
|
|
66486
66511
|
/* harmony default export */ const transform = ([callouts, code_tabs, transform_embeds, transform_images, gemoji_]);
|
|
66487
66512
|
|
|
66488
66513
|
;// CONCATENATED MODULE: ./node_modules/rehype-slug/node_modules/github-slugger/regex.js
|
|
@@ -83696,6 +83721,10 @@ const callout = (node, _, state, info) => {
|
|
|
83696
83721
|
const tracker = state.createTracker(info);
|
|
83697
83722
|
tracker.move('> ');
|
|
83698
83723
|
tracker.shift(2);
|
|
83724
|
+
// @note: compatability
|
|
83725
|
+
if (node.data.hProperties.title === '') {
|
|
83726
|
+
node.children.unshift({ type: 'paragraph', children: [{ type: 'text', value: '' }] });
|
|
83727
|
+
}
|
|
83699
83728
|
const map = (line, index, blank) => {
|
|
83700
83729
|
return `>${index === 0 ? ` ${node.data.hProperties.icon}` : ''}${blank ? '' : ' '}${line}`;
|
|
83701
83730
|
};
|
|
@@ -94896,7 +94925,7 @@ const compatibility_html = (node) => {
|
|
|
94896
94925
|
return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
|
|
94897
94926
|
};
|
|
94898
94927
|
const figureToImageBlock = (node) => {
|
|
94899
|
-
const _a = node.children.find((child) => child.type === 'image'), { align, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "url", "alt", "title"]);
|
|
94928
|
+
const _a = node.children.find((child) => child.type === 'image'), { align, border, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "border", "width", "src", "url", "alt", "title"]);
|
|
94900
94929
|
const { className } = image.data.hProperties;
|
|
94901
94930
|
const figcaption = node.children.find((child) => child.type === 'figcaption');
|
|
94902
94931
|
const caption = figcaption
|
|
@@ -94905,7 +94934,7 @@ const figureToImageBlock = (node) => {
|
|
|
94905
94934
|
children: figcaption.children,
|
|
94906
94935
|
}).trim()
|
|
94907
94936
|
: null;
|
|
94908
|
-
const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
|
|
94937
|
+
const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (border && { border })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
|
|
94909
94938
|
return `<Image ${formatProps(attributes)} />`;
|
|
94910
94939
|
};
|
|
94911
94940
|
const embedToEmbedBlock = (node) => {
|
|
@@ -95009,6 +95038,7 @@ const mdx_mdx = (tree, _a = {}) => {
|
|
|
95009
95038
|
.use(transform_div)
|
|
95010
95039
|
.use(readme_to_mdx)
|
|
95011
95040
|
.use(tables_to_jsx)
|
|
95041
|
+
.use(compatability)
|
|
95012
95042
|
.use(processor_compile)
|
|
95013
95043
|
.use(remarkStringify, opts);
|
|
95014
95044
|
return processor.stringify(processor.runSync(tree));
|
|
@@ -4,6 +4,7 @@ import readmeComponentsTransformer from './readme-components';
|
|
|
4
4
|
import readmeToMdx from './readme-to-mdx';
|
|
5
5
|
import variablesTransformer from './variables';
|
|
6
6
|
import tablesToJsx from './tables-to-jsx';
|
|
7
|
-
|
|
7
|
+
import compatabilityTransfomer from './compatability';
|
|
8
|
+
export { compatabilityTransfomer, divTransformer, readmeComponentsTransformer, readmeToMdx, injectComponents, variablesTransformer, tablesToJsx, };
|
|
8
9
|
declare const _default: (() => (tree: any) => void)[];
|
|
9
10
|
export default _default;
|
package/package.json
CHANGED