@readme/markdown 11.14.0 → 11.15.0
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/lib/index.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -70620,10 +70620,13 @@ const tagAttributePattern = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("[^"]*"|'[^'
|
|
|
70620
70620
|
const MAX_LOOKAHEAD = 30;
|
|
70621
70621
|
/**
|
|
70622
70622
|
* Tags that have dedicated transformers and should NOT be handled by this plugin.
|
|
70623
|
-
* These components have special parsing requirements that the generic component
|
|
70624
|
-
* block transformer cannot handle correctly
|
|
70623
|
+
* These components either have special parsing requirements that the generic component
|
|
70624
|
+
* block transformer cannot handle correctly, or are inline components that we don't
|
|
70625
|
+
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
70626
|
+
*
|
|
70627
|
+
* Glossary and Anchor are inline components.
|
|
70625
70628
|
*/
|
|
70626
|
-
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table']);
|
|
70629
|
+
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', 'Anchor']);
|
|
70627
70630
|
const inlineMdProcessor = unified().use(remarkParse);
|
|
70628
70631
|
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
70629
70632
|
/**
|
|
@@ -94413,6 +94416,92 @@ const normalizeEmphasisAST = () => (tree) => {
|
|
|
94413
94416
|
};
|
|
94414
94417
|
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
94415
94418
|
|
|
94419
|
+
;// ./processor/transform/mdxish/normalize-table-separator.ts
|
|
94420
|
+
/**
|
|
94421
|
+
* Preprocessor to normalize malformed GFM table separator syntax.
|
|
94422
|
+
*
|
|
94423
|
+
* Fixes the common mistake where the alignment colon is placed after the pipe
|
|
94424
|
+
* instead of before the dashes:
|
|
94425
|
+
*
|
|
94426
|
+
* Invalid: `|: ---` or `|:---` (colon after pipe)
|
|
94427
|
+
* Valid: `| :---` (colon before dashes)
|
|
94428
|
+
*
|
|
94429
|
+
* Also handles right alignment:
|
|
94430
|
+
* Invalid: `| ---:| ` with space before pipe
|
|
94431
|
+
* Valid: `| ---:|` (no space before closing pipe)
|
|
94432
|
+
*
|
|
94433
|
+
* This runs before remark-parse to ensure the table is recognized as a valid GFM table.
|
|
94434
|
+
*/
|
|
94435
|
+
/**
|
|
94436
|
+
* Pattern to match a table separator row.
|
|
94437
|
+
* A separator row consists of cells that contain only dashes, colons (for alignment), and spaces.
|
|
94438
|
+
*
|
|
94439
|
+
* Valid GFM separator formats:
|
|
94440
|
+
* - `---` or `----` (no alignment, defaults to left)
|
|
94441
|
+
* - `:---` (left aligned)
|
|
94442
|
+
* - `---:` (right aligned)
|
|
94443
|
+
* - `:---:` (center aligned)
|
|
94444
|
+
*
|
|
94445
|
+
* Invalid formats this fixes:
|
|
94446
|
+
* - `|: ---` → `| :---` (colon wrongly placed after pipe)
|
|
94447
|
+
* - `|:---` → `| :---` (colon directly after pipe, missing space)
|
|
94448
|
+
* - `|::---` or `| ::---` → `| :---` (double colon typo)
|
|
94449
|
+
*/
|
|
94450
|
+
// Match a line that looks like a table separator row
|
|
94451
|
+
// This regex captures the whole line if it contains only pipe-separated cells with dashes/colons
|
|
94452
|
+
const TABLE_SEPARATOR_LINE_REGEX = /^(\|[:\s-]+)+\|?\s*$/;
|
|
94453
|
+
// Match malformed left-alignment: `|: ` or `|:` followed by dashes
|
|
94454
|
+
// Captures: group 1 = pipe, group 2 = spaces after colon, group 3 = dashes
|
|
94455
|
+
const MALFORMED_LEFT_ALIGN_REGEX = /\|:(\s*)(-+)/g;
|
|
94456
|
+
// Match malformed double colon: `|::---` or `| ::---` → `| :---`
|
|
94457
|
+
const MALFORMED_DOUBLE_COLON_REGEX = /\|\s*::(\s*)(-+)/g;
|
|
94458
|
+
// Match malformed patterns with spaces before closing colons: `| --- : |` → `| ---: |`
|
|
94459
|
+
const MALFORMED_RIGHT_ALIGN_SPACE_REGEX = /(-+)\s+:(\s*\|)/g;
|
|
94460
|
+
// Match malformed center alignment with spaces: `| : --- : |` → `| :---: |`
|
|
94461
|
+
const MALFORMED_CENTER_ALIGN_REGEX = /\|:(\s+)(-+)(\s+):/g;
|
|
94462
|
+
/**
|
|
94463
|
+
* Normalizes a single table separator line.
|
|
94464
|
+
*/
|
|
94465
|
+
function normalizeTableSeparatorLine(line) {
|
|
94466
|
+
// Check if this line looks like a table separator
|
|
94467
|
+
if (!TABLE_SEPARATOR_LINE_REGEX.test(line)) {
|
|
94468
|
+
return line;
|
|
94469
|
+
}
|
|
94470
|
+
let normalized = line;
|
|
94471
|
+
// Fix `|::---` → `| :---` (double colon typo)
|
|
94472
|
+
// Must run before single colon fix to avoid partial replacement
|
|
94473
|
+
normalized = normalized.replace(MALFORMED_DOUBLE_COLON_REGEX, '| :$2');
|
|
94474
|
+
// Fix `|: ---` or `|:---` → `| :---`
|
|
94475
|
+
// The colon should be adjacent to the dashes, not the pipe
|
|
94476
|
+
normalized = normalized.replace(MALFORMED_LEFT_ALIGN_REGEX, '| :$2');
|
|
94477
|
+
// Fix `| --- : |` → `| ---: |`
|
|
94478
|
+
// Remove space before right-alignment colon
|
|
94479
|
+
normalized = normalized.replace(MALFORMED_RIGHT_ALIGN_SPACE_REGEX, '$1:$2');
|
|
94480
|
+
// Fix `| : --- : |` → `| :---: |`
|
|
94481
|
+
// Remove spaces around center-aligned dashes
|
|
94482
|
+
normalized = normalized.replace(MALFORMED_CENTER_ALIGN_REGEX, '| :$2:');
|
|
94483
|
+
return normalized;
|
|
94484
|
+
}
|
|
94485
|
+
/**
|
|
94486
|
+
* Preprocesses markdown content to normalize malformed table separator syntax.
|
|
94487
|
+
*
|
|
94488
|
+
* @param content - The raw markdown content
|
|
94489
|
+
* @returns The content with normalized table separators
|
|
94490
|
+
*/
|
|
94491
|
+
function normalizeTableSeparator(content) {
|
|
94492
|
+
const lines = content.split('\n');
|
|
94493
|
+
const normalizedLines = lines.map((line, index) => {
|
|
94494
|
+
const prevLine = index > 0 ? lines[index - 1] : '';
|
|
94495
|
+
const isPrevLineTableRow = prevLine.trim().startsWith('|');
|
|
94496
|
+
if (isPrevLineTableRow) {
|
|
94497
|
+
return normalizeTableSeparatorLine(line);
|
|
94498
|
+
}
|
|
94499
|
+
return line;
|
|
94500
|
+
});
|
|
94501
|
+
return normalizedLines.join('\n');
|
|
94502
|
+
}
|
|
94503
|
+
/* harmony default export */ const normalize_table_separator = ((/* unused pure expression or super */ null && (normalizeTableSeparator)));
|
|
94504
|
+
|
|
94416
94505
|
;// ./processor/transform/mdxish/restore-snake-case-component-name.ts
|
|
94417
94506
|
|
|
94418
94507
|
|
|
@@ -94676,6 +94765,7 @@ function loadComponents() {
|
|
|
94676
94765
|
|
|
94677
94766
|
|
|
94678
94767
|
|
|
94768
|
+
|
|
94679
94769
|
|
|
94680
94770
|
|
|
94681
94771
|
const defaultTransformers = [callouts, code_tabs, gemoji_, transform_embeds];
|
|
@@ -94688,9 +94778,11 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
94688
94778
|
// Preprocessing pipeline: Transform content to be parser-ready
|
|
94689
94779
|
// Step 1: Extract legacy magic blocks
|
|
94690
94780
|
const { replaced: contentAfterMagicBlocks, blocks } = extractMagicBlocks(mdContent);
|
|
94691
|
-
// Step 2:
|
|
94692
|
-
const
|
|
94693
|
-
// Step 3:
|
|
94781
|
+
// Step 2: Normalize malformed table separator syntax (e.g., `|: ---` → `| :---`)
|
|
94782
|
+
const contentAfterTableNormalization = normalizeTableSeparator(contentAfterMagicBlocks);
|
|
94783
|
+
// Step 3: Evaluate JSX expressions in attributes
|
|
94784
|
+
const contentAfterJSXEvaluation = preprocessJSXExpressions(contentAfterTableNormalization, jsxContext);
|
|
94785
|
+
// Step 4: Replace snake_case component names with parser-safe placeholders
|
|
94694
94786
|
// (e.g., <Snake_case /> → <MDXishSnakeCase0 /> which will be restored after parsing)
|
|
94695
94787
|
const { content: parserReadyContent, mapping: snakeCaseMapping } = processSnakeCaseComponent(contentAfterJSXEvaluation);
|
|
94696
94788
|
// Create string map for tailwind transformer
|
|
@@ -95312,7 +95404,6 @@ async function stripComments(doc, { mdx } = {}) {
|
|
|
95312
95404
|
|
|
95313
95405
|
|
|
95314
95406
|
|
|
95315
|
-
|
|
95316
95407
|
;// ./index.tsx
|
|
95317
95408
|
|
|
95318
95409
|
|
package/dist/main.node.js
CHANGED
|
@@ -90824,10 +90824,13 @@ const tagAttributePattern = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("[^"]*"|'[^'
|
|
|
90824
90824
|
const MAX_LOOKAHEAD = 30;
|
|
90825
90825
|
/**
|
|
90826
90826
|
* Tags that have dedicated transformers and should NOT be handled by this plugin.
|
|
90827
|
-
* These components have special parsing requirements that the generic component
|
|
90828
|
-
* block transformer cannot handle correctly
|
|
90827
|
+
* These components either have special parsing requirements that the generic component
|
|
90828
|
+
* block transformer cannot handle correctly, or are inline components that we don't
|
|
90829
|
+
* want to convert to mdxJsxFlowElement which is a block level element.
|
|
90830
|
+
*
|
|
90831
|
+
* Glossary and Anchor are inline components.
|
|
90829
90832
|
*/
|
|
90830
|
-
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table']);
|
|
90833
|
+
const EXCLUDED_TAGS = new Set(['HTMLBlock', 'Table', 'Glossary', 'Anchor']);
|
|
90831
90834
|
const inlineMdProcessor = unified().use(remarkParse);
|
|
90832
90835
|
const isClosingTag = (value, tag) => value.trim() === `</${tag}>`;
|
|
90833
90836
|
/**
|
|
@@ -114617,6 +114620,92 @@ const normalizeEmphasisAST = () => (tree) => {
|
|
|
114617
114620
|
};
|
|
114618
114621
|
/* harmony default export */ const normalize_malformed_md_syntax = (normalizeEmphasisAST);
|
|
114619
114622
|
|
|
114623
|
+
;// ./processor/transform/mdxish/normalize-table-separator.ts
|
|
114624
|
+
/**
|
|
114625
|
+
* Preprocessor to normalize malformed GFM table separator syntax.
|
|
114626
|
+
*
|
|
114627
|
+
* Fixes the common mistake where the alignment colon is placed after the pipe
|
|
114628
|
+
* instead of before the dashes:
|
|
114629
|
+
*
|
|
114630
|
+
* Invalid: `|: ---` or `|:---` (colon after pipe)
|
|
114631
|
+
* Valid: `| :---` (colon before dashes)
|
|
114632
|
+
*
|
|
114633
|
+
* Also handles right alignment:
|
|
114634
|
+
* Invalid: `| ---:| ` with space before pipe
|
|
114635
|
+
* Valid: `| ---:|` (no space before closing pipe)
|
|
114636
|
+
*
|
|
114637
|
+
* This runs before remark-parse to ensure the table is recognized as a valid GFM table.
|
|
114638
|
+
*/
|
|
114639
|
+
/**
|
|
114640
|
+
* Pattern to match a table separator row.
|
|
114641
|
+
* A separator row consists of cells that contain only dashes, colons (for alignment), and spaces.
|
|
114642
|
+
*
|
|
114643
|
+
* Valid GFM separator formats:
|
|
114644
|
+
* - `---` or `----` (no alignment, defaults to left)
|
|
114645
|
+
* - `:---` (left aligned)
|
|
114646
|
+
* - `---:` (right aligned)
|
|
114647
|
+
* - `:---:` (center aligned)
|
|
114648
|
+
*
|
|
114649
|
+
* Invalid formats this fixes:
|
|
114650
|
+
* - `|: ---` → `| :---` (colon wrongly placed after pipe)
|
|
114651
|
+
* - `|:---` → `| :---` (colon directly after pipe, missing space)
|
|
114652
|
+
* - `|::---` or `| ::---` → `| :---` (double colon typo)
|
|
114653
|
+
*/
|
|
114654
|
+
// Match a line that looks like a table separator row
|
|
114655
|
+
// This regex captures the whole line if it contains only pipe-separated cells with dashes/colons
|
|
114656
|
+
const TABLE_SEPARATOR_LINE_REGEX = /^(\|[:\s-]+)+\|?\s*$/;
|
|
114657
|
+
// Match malformed left-alignment: `|: ` or `|:` followed by dashes
|
|
114658
|
+
// Captures: group 1 = pipe, group 2 = spaces after colon, group 3 = dashes
|
|
114659
|
+
const MALFORMED_LEFT_ALIGN_REGEX = /\|:(\s*)(-+)/g;
|
|
114660
|
+
// Match malformed double colon: `|::---` or `| ::---` → `| :---`
|
|
114661
|
+
const MALFORMED_DOUBLE_COLON_REGEX = /\|\s*::(\s*)(-+)/g;
|
|
114662
|
+
// Match malformed patterns with spaces before closing colons: `| --- : |` → `| ---: |`
|
|
114663
|
+
const MALFORMED_RIGHT_ALIGN_SPACE_REGEX = /(-+)\s+:(\s*\|)/g;
|
|
114664
|
+
// Match malformed center alignment with spaces: `| : --- : |` → `| :---: |`
|
|
114665
|
+
const MALFORMED_CENTER_ALIGN_REGEX = /\|:(\s+)(-+)(\s+):/g;
|
|
114666
|
+
/**
|
|
114667
|
+
* Normalizes a single table separator line.
|
|
114668
|
+
*/
|
|
114669
|
+
function normalizeTableSeparatorLine(line) {
|
|
114670
|
+
// Check if this line looks like a table separator
|
|
114671
|
+
if (!TABLE_SEPARATOR_LINE_REGEX.test(line)) {
|
|
114672
|
+
return line;
|
|
114673
|
+
}
|
|
114674
|
+
let normalized = line;
|
|
114675
|
+
// Fix `|::---` → `| :---` (double colon typo)
|
|
114676
|
+
// Must run before single colon fix to avoid partial replacement
|
|
114677
|
+
normalized = normalized.replace(MALFORMED_DOUBLE_COLON_REGEX, '| :$2');
|
|
114678
|
+
// Fix `|: ---` or `|:---` → `| :---`
|
|
114679
|
+
// The colon should be adjacent to the dashes, not the pipe
|
|
114680
|
+
normalized = normalized.replace(MALFORMED_LEFT_ALIGN_REGEX, '| :$2');
|
|
114681
|
+
// Fix `| --- : |` → `| ---: |`
|
|
114682
|
+
// Remove space before right-alignment colon
|
|
114683
|
+
normalized = normalized.replace(MALFORMED_RIGHT_ALIGN_SPACE_REGEX, '$1:$2');
|
|
114684
|
+
// Fix `| : --- : |` → `| :---: |`
|
|
114685
|
+
// Remove spaces around center-aligned dashes
|
|
114686
|
+
normalized = normalized.replace(MALFORMED_CENTER_ALIGN_REGEX, '| :$2:');
|
|
114687
|
+
return normalized;
|
|
114688
|
+
}
|
|
114689
|
+
/**
|
|
114690
|
+
* Preprocesses markdown content to normalize malformed table separator syntax.
|
|
114691
|
+
*
|
|
114692
|
+
* @param content - The raw markdown content
|
|
114693
|
+
* @returns The content with normalized table separators
|
|
114694
|
+
*/
|
|
114695
|
+
function normalizeTableSeparator(content) {
|
|
114696
|
+
const lines = content.split('\n');
|
|
114697
|
+
const normalizedLines = lines.map((line, index) => {
|
|
114698
|
+
const prevLine = index > 0 ? lines[index - 1] : '';
|
|
114699
|
+
const isPrevLineTableRow = prevLine.trim().startsWith('|');
|
|
114700
|
+
if (isPrevLineTableRow) {
|
|
114701
|
+
return normalizeTableSeparatorLine(line);
|
|
114702
|
+
}
|
|
114703
|
+
return line;
|
|
114704
|
+
});
|
|
114705
|
+
return normalizedLines.join('\n');
|
|
114706
|
+
}
|
|
114707
|
+
/* harmony default export */ const normalize_table_separator = ((/* unused pure expression or super */ null && (normalizeTableSeparator)));
|
|
114708
|
+
|
|
114620
114709
|
;// ./processor/transform/mdxish/restore-snake-case-component-name.ts
|
|
114621
114710
|
|
|
114622
114711
|
|
|
@@ -114880,6 +114969,7 @@ function loadComponents() {
|
|
|
114880
114969
|
|
|
114881
114970
|
|
|
114882
114971
|
|
|
114972
|
+
|
|
114883
114973
|
|
|
114884
114974
|
|
|
114885
114975
|
const defaultTransformers = [callouts, code_tabs, gemoji_, transform_embeds];
|
|
@@ -114892,9 +114982,11 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
114892
114982
|
// Preprocessing pipeline: Transform content to be parser-ready
|
|
114893
114983
|
// Step 1: Extract legacy magic blocks
|
|
114894
114984
|
const { replaced: contentAfterMagicBlocks, blocks } = extractMagicBlocks(mdContent);
|
|
114895
|
-
// Step 2:
|
|
114896
|
-
const
|
|
114897
|
-
// Step 3:
|
|
114985
|
+
// Step 2: Normalize malformed table separator syntax (e.g., `|: ---` → `| :---`)
|
|
114986
|
+
const contentAfterTableNormalization = normalizeTableSeparator(contentAfterMagicBlocks);
|
|
114987
|
+
// Step 3: Evaluate JSX expressions in attributes
|
|
114988
|
+
const contentAfterJSXEvaluation = preprocessJSXExpressions(contentAfterTableNormalization, jsxContext);
|
|
114989
|
+
// Step 4: Replace snake_case component names with parser-safe placeholders
|
|
114898
114990
|
// (e.g., <Snake_case /> → <MDXishSnakeCase0 /> which will be restored after parsing)
|
|
114899
114991
|
const { content: parserReadyContent, mapping: snakeCaseMapping } = processSnakeCaseComponent(contentAfterJSXEvaluation);
|
|
114900
114992
|
// Create string map for tailwind transformer
|
|
@@ -115516,7 +115608,6 @@ async function stripComments(doc, { mdx } = {}) {
|
|
|
115516
115608
|
|
|
115517
115609
|
|
|
115518
115610
|
|
|
115519
|
-
|
|
115520
115611
|
;// ./index.tsx
|
|
115521
115612
|
|
|
115522
115613
|
|