@readme/markdown 14.14.1 → 14.14.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
|
@@ -1517,7 +1517,7 @@ module.exports = function (key) {
|
|
|
1517
1517
|
|
|
1518
1518
|
/***/ }),
|
|
1519
1519
|
|
|
1520
|
-
/***/
|
|
1520
|
+
/***/ 1847:
|
|
1521
1521
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1522
1522
|
|
|
1523
1523
|
var isObject = __webpack_require__(3305);
|
|
@@ -2213,7 +2213,7 @@ var meta = module.exports = {
|
|
|
2213
2213
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2214
2214
|
|
|
2215
2215
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
2216
|
-
var anObject = __webpack_require__(
|
|
2216
|
+
var anObject = __webpack_require__(1847);
|
|
2217
2217
|
var dPs = __webpack_require__(1626);
|
|
2218
2218
|
var enumBugKeys = __webpack_require__(6140);
|
|
2219
2219
|
var IE_PROTO = __webpack_require__(766)('IE_PROTO');
|
|
@@ -2260,7 +2260,7 @@ module.exports = Object.create || function create(O, Properties) {
|
|
|
2260
2260
|
/***/ 7967:
|
|
2261
2261
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2262
2262
|
|
|
2263
|
-
var anObject = __webpack_require__(
|
|
2263
|
+
var anObject = __webpack_require__(1847);
|
|
2264
2264
|
var IE8_DOM_DEFINE = __webpack_require__(2956);
|
|
2265
2265
|
var toPrimitive = __webpack_require__(3048);
|
|
2266
2266
|
var dP = Object.defineProperty;
|
|
@@ -2284,7 +2284,7 @@ exports.f = __webpack_require__(1763) ? Object.defineProperty : function defineP
|
|
|
2284
2284
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2285
2285
|
|
|
2286
2286
|
var dP = __webpack_require__(7967);
|
|
2287
|
-
var anObject = __webpack_require__(
|
|
2287
|
+
var anObject = __webpack_require__(1847);
|
|
2288
2288
|
var getKeys = __webpack_require__(1311);
|
|
2289
2289
|
|
|
2290
2290
|
module.exports = __webpack_require__(1763) ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
@@ -2460,7 +2460,7 @@ module.exports = function (KEY, exec) {
|
|
|
2460
2460
|
// all object keys, includes non-enumerable and symbols
|
|
2461
2461
|
var gOPN = __webpack_require__(9415);
|
|
2462
2462
|
var gOPS = __webpack_require__(1060);
|
|
2463
|
-
var anObject = __webpack_require__(
|
|
2463
|
+
var anObject = __webpack_require__(1847);
|
|
2464
2464
|
var Reflect = (__webpack_require__(7526).Reflect);
|
|
2465
2465
|
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
|
|
2466
2466
|
var keys = gOPN.f(anObject(it));
|
|
@@ -2530,7 +2530,7 @@ var TPL = ('' + $toString).split(TO_STRING);
|
|
|
2530
2530
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
2531
2531
|
/* eslint-disable no-proto */
|
|
2532
2532
|
var isObject = __webpack_require__(3305);
|
|
2533
|
-
var anObject = __webpack_require__(
|
|
2533
|
+
var anObject = __webpack_require__(1847);
|
|
2534
2534
|
var check = function (O, proto) {
|
|
2535
2535
|
anObject(O);
|
|
2536
2536
|
if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
|
|
@@ -3133,7 +3133,7 @@ var wksExt = __webpack_require__(7960);
|
|
|
3133
3133
|
var wksDefine = __webpack_require__(5392);
|
|
3134
3134
|
var enumKeys = __webpack_require__(5969);
|
|
3135
3135
|
var isArray = __webpack_require__(7981);
|
|
3136
|
-
var anObject = __webpack_require__(
|
|
3136
|
+
var anObject = __webpack_require__(1847);
|
|
3137
3137
|
var isObject = __webpack_require__(3305);
|
|
3138
3138
|
var toObject = __webpack_require__(8270);
|
|
3139
3139
|
var toIObject = __webpack_require__(7221);
|
|
@@ -106417,10 +106417,44 @@ const restoreBooleanProperties = () => tree => {
|
|
|
106417
106417
|
};
|
|
106418
106418
|
|
|
106419
106419
|
|
|
106420
|
+
;// ./processor/transform/mdxish/tables/gfm-cell-normalization.ts
|
|
106421
|
+
/** `<br />` is the only line break a GFM pipe cell can carry, since cells are single-line. */
|
|
106422
|
+
const createLineBreak = () => ({
|
|
106423
|
+
type: 'mdxJsxTextElement',
|
|
106424
|
+
name: 'br',
|
|
106425
|
+
attributes: [],
|
|
106426
|
+
children: [],
|
|
106427
|
+
});
|
|
106428
|
+
const createText = (value) => ({ type: 'text', value });
|
|
106429
|
+
const isText = (node) => node.type === 'text';
|
|
106430
|
+
const hasChildren = (node) => 'children' in node;
|
|
106431
|
+
const splitOnLineBreaks = (value) => value.split('\n').reduce((nodes, segment, index) => {
|
|
106432
|
+
if (index > 0)
|
|
106433
|
+
nodes.push(createLineBreak());
|
|
106434
|
+
if (segment)
|
|
106435
|
+
nodes.push(createText(segment));
|
|
106436
|
+
return nodes;
|
|
106437
|
+
}, []);
|
|
106438
|
+
const normalizeNodes = (nodes) => nodes.flatMap(node => {
|
|
106439
|
+
if (node.type === 'break')
|
|
106440
|
+
return createLineBreak();
|
|
106441
|
+
if (isText(node))
|
|
106442
|
+
return splitOnLineBreaks(node.value);
|
|
106443
|
+
if (hasChildren(node))
|
|
106444
|
+
return { ...node, children: normalizeNodes(node.children) };
|
|
106445
|
+
return node;
|
|
106446
|
+
});
|
|
106447
|
+
/**
|
|
106448
|
+
* Returns a copy of the cell's children with line breaks — `break` nodes and newlines inside
|
|
106449
|
+
* text — rewritten to the `<br />` a single-line GFM pipe cell can carry.
|
|
106450
|
+
*/
|
|
106451
|
+
const normalizeCellChildrenForGfm = (cell) => normalizeNodes(cell.children);
|
|
106452
|
+
|
|
106420
106453
|
;// ./processor/transform/mdxish/tables/mdxish-tables-to-jsx.ts
|
|
106421
106454
|
|
|
106422
106455
|
|
|
106423
106456
|
|
|
106457
|
+
|
|
106424
106458
|
const SELF_CLOSING_JSX_REGEX = /^\s*<[A-Z][^>]*\/>\s*$/;
|
|
106425
106459
|
const mdxish_tables_to_jsx_alignToStyle = (align) => {
|
|
106426
106460
|
if (!align || align === 'left')
|
|
@@ -106436,6 +106470,38 @@ const mdxish_tables_to_jsx_alignToStyle = (align) => {
|
|
|
106436
106470
|
};
|
|
106437
106471
|
const mdxish_tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
|
|
106438
106472
|
const mdxish_tables_to_jsx_isLiteral = (node) => 'value' in node;
|
|
106473
|
+
/**
|
|
106474
|
+
* Block-level content that a single-line GFM cell cannot hold. `phrasing()` returns true
|
|
106475
|
+
* for inline types (text, emphasis, strong, link…), which are safe to keep.
|
|
106476
|
+
*/
|
|
106477
|
+
const isFlowChild = (child) => {
|
|
106478
|
+
if (child.type === 'paragraph' || child.type === 'plain' || child.type === 'escape')
|
|
106479
|
+
return false;
|
|
106480
|
+
if (child.type === NodeTypes.variable)
|
|
106481
|
+
return false;
|
|
106482
|
+
if (phrasing(child))
|
|
106483
|
+
return false;
|
|
106484
|
+
if (child.type === 'html')
|
|
106485
|
+
return SELF_CLOSING_JSX_REGEX.test(child.value);
|
|
106486
|
+
return true;
|
|
106487
|
+
};
|
|
106488
|
+
/** A newline in a normalized cell (e.g. inside `inlineCode`) has no inline equivalent. */
|
|
106489
|
+
const containsLiteralNewline = (nodes) => nodes.some(node => (mdxish_tables_to_jsx_isLiteral(node) && node.value.includes('\n')) || (hasChildren(node) && containsLiteralNewline(node.children)));
|
|
106490
|
+
/** True when normalized cell content survives a single-line GFM pipe cell without losing structure. */
|
|
106491
|
+
const canCellBeGfm = (children) => {
|
|
106492
|
+
// Multiple paragraphs are distinct blocks; a single-line cell cannot keep them apart.
|
|
106493
|
+
if (children.filter(child => child.type === 'paragraph').length > 1)
|
|
106494
|
+
return false;
|
|
106495
|
+
if (children.some(isFlowChild))
|
|
106496
|
+
return false;
|
|
106497
|
+
return !containsLiteralNewline(children);
|
|
106498
|
+
};
|
|
106499
|
+
/** On the promote path a `break` would serialize as a dangling `\`, so collapse it to a newline. */
|
|
106500
|
+
const flattenBreaksToNewlines = (cell) => {
|
|
106501
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
106502
|
+
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
106503
|
+
});
|
|
106504
|
+
};
|
|
106439
106505
|
/**
|
|
106440
106506
|
* Mdxish-specific version of `tablesToJsx`. Differs from the shared MDX version:
|
|
106441
106507
|
*
|
|
@@ -106446,52 +106512,25 @@ const mdxish_tables_to_jsx_isLiteral = (node) => 'value' in node;
|
|
|
106446
106512
|
*/
|
|
106447
106513
|
const mdxishTablesToJsx = () => tree => {
|
|
106448
106514
|
visit(tree, (node) => ['table', 'tableau'].includes(node.type), (table, index, parent) => {
|
|
106449
|
-
|
|
106515
|
+
const gfmCells = [];
|
|
106516
|
+
let requiresJsxTable = false;
|
|
106450
106517
|
visit(table, mdxish_tables_to_jsx_isTableCell, (cell) => {
|
|
106451
|
-
|
|
106452
|
-
|
|
106453
|
-
|
|
106454
|
-
|
|
106455
|
-
});
|
|
106456
|
-
// A cell with more than one paragraph child cannot be serialized as GFM
|
|
106457
|
-
// (pipe tables are single-line per cell), so force JSX <Table> output to
|
|
106458
|
-
// preserve paragraph separation.
|
|
106459
|
-
const paragraphCount = cell.children.filter(child => child.type === 'paragraph').length;
|
|
106460
|
-
if (paragraphCount > 1) {
|
|
106461
|
-
hasFlowContent = true;
|
|
106462
|
-
return;
|
|
106463
|
-
}
|
|
106464
|
-
// Check if any child is "flow" content (block-level) that requires JSX <Table>
|
|
106465
|
-
// serialization instead of GFM. `phrasing()` from mdast-util-phrasing returns
|
|
106466
|
-
// true for inline node types (text, emphasis, strong, link, etc.) which are
|
|
106467
|
-
// safe to keep in GFM cells.
|
|
106468
|
-
const hasFlowChild = cell.children.some(child => {
|
|
106469
|
-
if (child.type === 'paragraph' || child.type === 'plain' || child.type === 'escape')
|
|
106470
|
-
return false;
|
|
106471
|
-
if (child.type === NodeTypes.variable)
|
|
106472
|
-
return false;
|
|
106473
|
-
if (phrasing(child))
|
|
106474
|
-
return false;
|
|
106475
|
-
if (child.type === 'html') {
|
|
106476
|
-
return SELF_CLOSING_JSX_REGEX.test(child.value);
|
|
106477
|
-
}
|
|
106478
|
-
return true;
|
|
106479
|
-
});
|
|
106480
|
-
if (hasFlowChild) {
|
|
106481
|
-
hasFlowContent = true;
|
|
106482
|
-
}
|
|
106483
|
-
if (!hasFlowContent) {
|
|
106484
|
-
visit(cell, mdxish_tables_to_jsx_isLiteral, (node) => {
|
|
106485
|
-
if (node.value.match(/\n/)) {
|
|
106486
|
-
hasFlowContent = true;
|
|
106487
|
-
}
|
|
106488
|
-
});
|
|
106518
|
+
const normalized = normalizeCellChildrenForGfm(cell);
|
|
106519
|
+
if (!canCellBeGfm(normalized)) {
|
|
106520
|
+
requiresJsxTable = true;
|
|
106521
|
+
return EXIT;
|
|
106489
106522
|
}
|
|
106523
|
+
gfmCells.push([cell, normalized]);
|
|
106524
|
+
return undefined;
|
|
106490
106525
|
});
|
|
106491
|
-
if (!
|
|
106526
|
+
if (!requiresJsxTable) {
|
|
106527
|
+
gfmCells.forEach(([cell, children]) => {
|
|
106528
|
+
cell.children = children;
|
|
106529
|
+
});
|
|
106492
106530
|
table.type = 'table';
|
|
106493
106531
|
return;
|
|
106494
106532
|
}
|
|
106533
|
+
visit(table, mdxish_tables_to_jsx_isTableCell, flattenBreaksToNewlines);
|
|
106495
106534
|
const styles = table.align.map(mdxish_tables_to_jsx_alignToStyle);
|
|
106496
106535
|
const head = {
|
|
106497
106536
|
attributes: [],
|
package/dist/main.node.js
CHANGED
|
@@ -126641,10 +126641,44 @@ const restoreBooleanProperties = () => tree => {
|
|
|
126641
126641
|
};
|
|
126642
126642
|
|
|
126643
126643
|
|
|
126644
|
+
;// ./processor/transform/mdxish/tables/gfm-cell-normalization.ts
|
|
126645
|
+
/** `<br />` is the only line break a GFM pipe cell can carry, since cells are single-line. */
|
|
126646
|
+
const createLineBreak = () => ({
|
|
126647
|
+
type: 'mdxJsxTextElement',
|
|
126648
|
+
name: 'br',
|
|
126649
|
+
attributes: [],
|
|
126650
|
+
children: [],
|
|
126651
|
+
});
|
|
126652
|
+
const createText = (value) => ({ type: 'text', value });
|
|
126653
|
+
const isText = (node) => node.type === 'text';
|
|
126654
|
+
const hasChildren = (node) => 'children' in node;
|
|
126655
|
+
const splitOnLineBreaks = (value) => value.split('\n').reduce((nodes, segment, index) => {
|
|
126656
|
+
if (index > 0)
|
|
126657
|
+
nodes.push(createLineBreak());
|
|
126658
|
+
if (segment)
|
|
126659
|
+
nodes.push(createText(segment));
|
|
126660
|
+
return nodes;
|
|
126661
|
+
}, []);
|
|
126662
|
+
const normalizeNodes = (nodes) => nodes.flatMap(node => {
|
|
126663
|
+
if (node.type === 'break')
|
|
126664
|
+
return createLineBreak();
|
|
126665
|
+
if (isText(node))
|
|
126666
|
+
return splitOnLineBreaks(node.value);
|
|
126667
|
+
if (hasChildren(node))
|
|
126668
|
+
return { ...node, children: normalizeNodes(node.children) };
|
|
126669
|
+
return node;
|
|
126670
|
+
});
|
|
126671
|
+
/**
|
|
126672
|
+
* Returns a copy of the cell's children with line breaks — `break` nodes and newlines inside
|
|
126673
|
+
* text — rewritten to the `<br />` a single-line GFM pipe cell can carry.
|
|
126674
|
+
*/
|
|
126675
|
+
const normalizeCellChildrenForGfm = (cell) => normalizeNodes(cell.children);
|
|
126676
|
+
|
|
126644
126677
|
;// ./processor/transform/mdxish/tables/mdxish-tables-to-jsx.ts
|
|
126645
126678
|
|
|
126646
126679
|
|
|
126647
126680
|
|
|
126681
|
+
|
|
126648
126682
|
const SELF_CLOSING_JSX_REGEX = /^\s*<[A-Z][^>]*\/>\s*$/;
|
|
126649
126683
|
const mdxish_tables_to_jsx_alignToStyle = (align) => {
|
|
126650
126684
|
if (!align || align === 'left')
|
|
@@ -126660,6 +126694,38 @@ const mdxish_tables_to_jsx_alignToStyle = (align) => {
|
|
|
126660
126694
|
};
|
|
126661
126695
|
const mdxish_tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
|
|
126662
126696
|
const mdxish_tables_to_jsx_isLiteral = (node) => 'value' in node;
|
|
126697
|
+
/**
|
|
126698
|
+
* Block-level content that a single-line GFM cell cannot hold. `phrasing()` returns true
|
|
126699
|
+
* for inline types (text, emphasis, strong, link…), which are safe to keep.
|
|
126700
|
+
*/
|
|
126701
|
+
const isFlowChild = (child) => {
|
|
126702
|
+
if (child.type === 'paragraph' || child.type === 'plain' || child.type === 'escape')
|
|
126703
|
+
return false;
|
|
126704
|
+
if (child.type === NodeTypes.variable)
|
|
126705
|
+
return false;
|
|
126706
|
+
if (phrasing(child))
|
|
126707
|
+
return false;
|
|
126708
|
+
if (child.type === 'html')
|
|
126709
|
+
return SELF_CLOSING_JSX_REGEX.test(child.value);
|
|
126710
|
+
return true;
|
|
126711
|
+
};
|
|
126712
|
+
/** A newline in a normalized cell (e.g. inside `inlineCode`) has no inline equivalent. */
|
|
126713
|
+
const containsLiteralNewline = (nodes) => nodes.some(node => (mdxish_tables_to_jsx_isLiteral(node) && node.value.includes('\n')) || (hasChildren(node) && containsLiteralNewline(node.children)));
|
|
126714
|
+
/** True when normalized cell content survives a single-line GFM pipe cell without losing structure. */
|
|
126715
|
+
const canCellBeGfm = (children) => {
|
|
126716
|
+
// Multiple paragraphs are distinct blocks; a single-line cell cannot keep them apart.
|
|
126717
|
+
if (children.filter(child => child.type === 'paragraph').length > 1)
|
|
126718
|
+
return false;
|
|
126719
|
+
if (children.some(isFlowChild))
|
|
126720
|
+
return false;
|
|
126721
|
+
return !containsLiteralNewline(children);
|
|
126722
|
+
};
|
|
126723
|
+
/** On the promote path a `break` would serialize as a dangling `\`, so collapse it to a newline. */
|
|
126724
|
+
const flattenBreaksToNewlines = (cell) => {
|
|
126725
|
+
visit(cell, 'break', (_, index, parent) => {
|
|
126726
|
+
parent.children.splice(index, 1, { type: 'text', value: '\n' });
|
|
126727
|
+
});
|
|
126728
|
+
};
|
|
126663
126729
|
/**
|
|
126664
126730
|
* Mdxish-specific version of `tablesToJsx`. Differs from the shared MDX version:
|
|
126665
126731
|
*
|
|
@@ -126670,52 +126736,25 @@ const mdxish_tables_to_jsx_isLiteral = (node) => 'value' in node;
|
|
|
126670
126736
|
*/
|
|
126671
126737
|
const mdxishTablesToJsx = () => tree => {
|
|
126672
126738
|
visit(tree, (node) => ['table', 'tableau'].includes(node.type), (table, index, parent) => {
|
|
126673
|
-
|
|
126739
|
+
const gfmCells = [];
|
|
126740
|
+
let requiresJsxTable = false;
|
|
126674
126741
|
visit(table, mdxish_tables_to_jsx_isTableCell, (cell) => {
|
|
126675
|
-
|
|
126676
|
-
|
|
126677
|
-
|
|
126678
|
-
|
|
126679
|
-
});
|
|
126680
|
-
// A cell with more than one paragraph child cannot be serialized as GFM
|
|
126681
|
-
// (pipe tables are single-line per cell), so force JSX <Table> output to
|
|
126682
|
-
// preserve paragraph separation.
|
|
126683
|
-
const paragraphCount = cell.children.filter(child => child.type === 'paragraph').length;
|
|
126684
|
-
if (paragraphCount > 1) {
|
|
126685
|
-
hasFlowContent = true;
|
|
126686
|
-
return;
|
|
126687
|
-
}
|
|
126688
|
-
// Check if any child is "flow" content (block-level) that requires JSX <Table>
|
|
126689
|
-
// serialization instead of GFM. `phrasing()` from mdast-util-phrasing returns
|
|
126690
|
-
// true for inline node types (text, emphasis, strong, link, etc.) which are
|
|
126691
|
-
// safe to keep in GFM cells.
|
|
126692
|
-
const hasFlowChild = cell.children.some(child => {
|
|
126693
|
-
if (child.type === 'paragraph' || child.type === 'plain' || child.type === 'escape')
|
|
126694
|
-
return false;
|
|
126695
|
-
if (child.type === NodeTypes.variable)
|
|
126696
|
-
return false;
|
|
126697
|
-
if (phrasing(child))
|
|
126698
|
-
return false;
|
|
126699
|
-
if (child.type === 'html') {
|
|
126700
|
-
return SELF_CLOSING_JSX_REGEX.test(child.value);
|
|
126701
|
-
}
|
|
126702
|
-
return true;
|
|
126703
|
-
});
|
|
126704
|
-
if (hasFlowChild) {
|
|
126705
|
-
hasFlowContent = true;
|
|
126706
|
-
}
|
|
126707
|
-
if (!hasFlowContent) {
|
|
126708
|
-
visit(cell, mdxish_tables_to_jsx_isLiteral, (node) => {
|
|
126709
|
-
if (node.value.match(/\n/)) {
|
|
126710
|
-
hasFlowContent = true;
|
|
126711
|
-
}
|
|
126712
|
-
});
|
|
126742
|
+
const normalized = normalizeCellChildrenForGfm(cell);
|
|
126743
|
+
if (!canCellBeGfm(normalized)) {
|
|
126744
|
+
requiresJsxTable = true;
|
|
126745
|
+
return EXIT;
|
|
126713
126746
|
}
|
|
126747
|
+
gfmCells.push([cell, normalized]);
|
|
126748
|
+
return undefined;
|
|
126714
126749
|
});
|
|
126715
|
-
if (!
|
|
126750
|
+
if (!requiresJsxTable) {
|
|
126751
|
+
gfmCells.forEach(([cell, children]) => {
|
|
126752
|
+
cell.children = children;
|
|
126753
|
+
});
|
|
126716
126754
|
table.type = 'table';
|
|
126717
126755
|
return;
|
|
126718
126756
|
}
|
|
126757
|
+
visit(table, mdxish_tables_to_jsx_isTableCell, flattenBreaksToNewlines);
|
|
126719
126758
|
const styles = table.align.map(mdxish_tables_to_jsx_alignToStyle);
|
|
126720
126759
|
const head = {
|
|
126721
126760
|
attributes: [],
|