@readme/markdown 14.1.3 → 14.2.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/main.js CHANGED
@@ -53325,9 +53325,16 @@ function formatHtmlForMdxish(html) {
53325
53325
  }
53326
53326
  // Removes the leading/trailing newlines
53327
53327
  let cleaned = processed.replace(/^\s*\n|\n\s*$/g, '');
53328
- // Convert literal \n sequences to actual newlines BEFORE processing backticks
53329
- // This prevents the backtick unescaping regex from incorrectly matching \n sequences
53330
- cleaned = cleaned.replace(/\\n/g, '\n');
53328
+ // Convert literal \n sequences to actual newlines only inside <pre> and <code>.
53329
+ // Because <pre> needs to respect the newline visual and
53330
+ // escape characters should be processed in the <code> tag.
53331
+ //
53332
+ // We don't want to unescape every \n because it might break the HTML & cause errors
53333
+ // Example: <script>console.log("\n");</script>
53334
+ // Would get turned into: <script>console.log("
53335
+ // ");</script>
53336
+ // which is invalid javascript and will cause error
53337
+ cleaned = cleaned.replace(/(<(pre|code)\b[^>]*>)([\s\S]*?)(<\/\2>)/gi, (_m, open, _tag, inner, close) => open + inner.replace(/\\n/g, '\n') + close);
53331
53338
  // Unescape backticks: \` -> ` (users escape backticks in template literals)
53332
53339
  // Handle both cases: \` (adjacent) and \ followed by ` (split by markdown parser)
53333
53340
  cleaned = cleaned.replace(/\\`/g, '`');
@@ -71907,7 +71914,7 @@ const hasFlowContent = (nodes) => {
71907
71914
  * a markdown table (phrasing-only) or keep as JSX <Table> (has flow content).
71908
71915
  */
71909
71916
  const processTableNode = (node, index, parent, documentPosition) => {
71910
- if (node.name !== 'Table')
71917
+ if (node.name !== 'Table' && node.name !== 'table')
71911
71918
  return;
71912
71919
  const position = documentPosition ?? node.position;
71913
71920
  const { align: alignAttr } = getAttrs(node);
@@ -72021,7 +72028,7 @@ const mdxishTables = () => tree => {
72021
72028
  const node = _node;
72022
72029
  if (typeof index !== 'number' || !parent || !('children' in parent))
72023
72030
  return;
72024
- if (!node.value.startsWith('<Table'))
72031
+ if (!node.value.startsWith('<Table') && !node.value.startsWith('<table'))
72025
72032
  return;
72026
72033
  try {
72027
72034
  const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(node.value));
@@ -72043,13 +72050,10 @@ const mdxishTables = () => tree => {
72043
72050
  }
72044
72051
  });
72045
72052
  visit(parsed, isMDXElement, (tableNode) => {
72046
- if (tableNode.name === 'Table') {
72047
- processTableNode(tableNode, index, parent, node.position);
72048
- // Stop after the outermost Table so nested Tables don't overwrite parent.children[index]
72049
- // we let it get handled naturally
72050
- return EXIT;
72051
- }
72052
- return undefined;
72053
+ if (tableNode.name !== 'Table' && tableNode.name !== 'table')
72054
+ return undefined;
72055
+ processTableNode(tableNode, index, parent, node.position);
72056
+ return EXIT;
72053
72057
  });
72054
72058
  }
72055
72059
  catch {
@@ -84805,6 +84809,63 @@ function rehypeSanitize(options) {
84805
84809
  }
84806
84810
  }
84807
84811
 
84812
+ ;// ./node_modules/mdast-util-newline-to-break/lib/index.js
84813
+ /**
84814
+ * @typedef {import('mdast').Nodes} Nodes
84815
+ * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction
84816
+ */
84817
+
84818
+
84819
+
84820
+ /**
84821
+ * Turn normal line endings into hard breaks.
84822
+ *
84823
+ * @param {Nodes} tree
84824
+ * Tree to change.
84825
+ * @returns {undefined}
84826
+ * Nothing.
84827
+ */
84828
+ function newlineToBreak(tree) {
84829
+ findAndReplace(tree, [/\r?\n|\r/g, lib_replace])
84830
+ }
84831
+
84832
+ /**
84833
+ * Replace line endings.
84834
+ *
84835
+ * @type {ReplaceFunction}
84836
+ */
84837
+ function lib_replace() {
84838
+ return {type: 'break'}
84839
+ }
84840
+
84841
+ ;// ./node_modules/remark-breaks/lib/index.js
84842
+ /**
84843
+ * @typedef {import('mdast').Root} Root
84844
+ */
84845
+
84846
+
84847
+
84848
+ /**
84849
+ * Support hard breaks without needing spaces or escapes (turns enters into
84850
+ * `<br>`s).
84851
+ *
84852
+ * @returns
84853
+ * Transform.
84854
+ */
84855
+ function remarkBreaks() {
84856
+ /**
84857
+ * Transform.
84858
+ *
84859
+ * @param {Root} tree
84860
+ * Tree.
84861
+ * @returns {undefined}
84862
+ * Nothing.
84863
+ */
84864
+ return function (tree) {
84865
+ newlineToBreak(tree)
84866
+ }
84867
+ }
84868
+
84808
84869
  ;// ./errors/mdx-syntax-error.ts
84809
84870
  class MdxSyntaxError extends SyntaxError {
84810
84871
  original = null;
@@ -87610,6 +87671,7 @@ const tocHastToMdx = (toc, components, variables) => {
87610
87671
 
87611
87672
 
87612
87673
 
87674
+
87613
87675
  const sanitizeSchema = cjs_default()(defaultSchema, {
87614
87676
  attributes: {
87615
87677
  a: ['target'],
@@ -87618,12 +87680,13 @@ const sanitizeSchema = cjs_default()(defaultSchema, {
87618
87680
  href: ['doc', 'ref', 'blog', 'changelog', 'page'],
87619
87681
  },
87620
87682
  });
87621
- const compile_compile = (text, { components = {}, missingComponents, copyButtons, useTailwind, ...opts } = {}) => {
87683
+ const compile_compile = (text, { components = {}, missingComponents, copyButtons, useTailwind, hardBreaks, ...opts } = {}) => {
87622
87684
  // Destructure at runtime to avoid circular dependency issues
87623
87685
  const { codeTabsTransformer, ...transforms } = defaultTransforms;
87624
87686
  const remarkPlugins = [
87625
87687
  remarkFrontmatter,
87626
87688
  remarkGfm,
87689
+ ...(hardBreaks ? [remarkBreaks] : []),
87627
87690
  ...Object.values(transforms),
87628
87691
  [codeTabsTransformer, { copyButtons }],
87629
87692
  [
@@ -94029,63 +94092,6 @@ function rehypeStringify(options) {
94029
94092
  }
94030
94093
  }
94031
94094
 
94032
- ;// ./node_modules/mdast-util-newline-to-break/lib/index.js
94033
- /**
94034
- * @typedef {import('mdast').Nodes} Nodes
94035
- * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction
94036
- */
94037
-
94038
-
94039
-
94040
- /**
94041
- * Turn normal line endings into hard breaks.
94042
- *
94043
- * @param {Nodes} tree
94044
- * Tree to change.
94045
- * @returns {undefined}
94046
- * Nothing.
94047
- */
94048
- function newlineToBreak(tree) {
94049
- findAndReplace(tree, [/\r?\n|\r/g, lib_replace])
94050
- }
94051
-
94052
- /**
94053
- * Replace line endings.
94054
- *
94055
- * @type {ReplaceFunction}
94056
- */
94057
- function lib_replace() {
94058
- return {type: 'break'}
94059
- }
94060
-
94061
- ;// ./node_modules/remark-breaks/lib/index.js
94062
- /**
94063
- * @typedef {import('mdast').Root} Root
94064
- */
94065
-
94066
-
94067
-
94068
- /**
94069
- * Support hard breaks without needing spaces or escapes (turns enters into
94070
- * `<br>`s).
94071
- *
94072
- * @returns
94073
- * Transform.
94074
- */
94075
- function remarkBreaks() {
94076
- /**
94077
- * Transform.
94078
- *
94079
- * @param {Root} tree
94080
- * Tree.
94081
- * @returns {undefined}
94082
- * Nothing.
94083
- */
94084
- return function (tree) {
94085
- newlineToBreak(tree)
94086
- }
94087
- }
94088
-
94089
94095
  ;// ./processor/plugin/flatten-table-cell-paragraphs.ts
94090
94096
 
94091
94097
  /** List elements that cause margin issues when adjacent to paragraphs */
@@ -98914,8 +98920,8 @@ const HTML_ELEMENT_BLOCK_RE = /<([a-zA-Z][a-zA-Z0-9-]*)[\s>][\s\S]*?<\/\1>/g;
98914
98920
  const NEWLINE_WITH_WHITESPACE_RE = /[^\S\n]*\n[^\S\n]*/g;
98915
98921
  /** Matches a closing block-level tag followed by non-tag text or by a newline then non-blank content. */
98916
98922
  const CLOSE_BLOCK_TAG_BOUNDARY_RE = /<\/([a-zA-Z][a-zA-Z0-9-]*)>\s*(?:(?!<)(\S)|\n([^\n]))/g;
98917
- /** Tests whether a string contains a complete HTML element (open + close tag). */
98918
- const COMPLETE_HTML_ELEMENT_RE = /<[a-zA-Z][^>]*>[\s\S]*<\/[a-zA-Z]/;
98923
+ /** Strips HTML open/close tags. Used to detect non-tag inner text content. */
98924
+ const HTML_TAG_STRIP_RE = /<\/?[a-zA-Z][^>]*>/g;
98919
98925
 
98920
98926
  ;// ./processor/transform/mdxish/magic-blocks/placeholder.ts
98921
98927
  const EMPTY_IMAGE_PLACEHOLDER = {
@@ -99155,10 +99161,12 @@ const parseTableCell = (text) => {
99155
99161
  const trimmedLines = normalized.split('\n').map(line => line.trimStart());
99156
99162
  const processed = trimmedLines.join('\n');
99157
99163
  const tree = contentParser.runSync(contentParser.parse(processed));
99158
- // Process markdown inside complete HTML elements (e.g. _emphasis_ within <li>).
99159
- // Bare tags like "<i>" are left for rehypeRaw since rehype-parse would mangle them.
99164
+ // Process markdown inside HTML blocks that have non-tag inner text (e.g. `<div>**x**`
99165
+ // or `<ul><li>_x_</li></ul>`). Pure bare tags like "<i>" or "<br>" are left for rehypeRaw
99166
+ // since rehype-parse would mangle them (auto-closing void/inline elements).
99160
99167
  visit(tree, 'html', (node) => {
99161
- if (COMPLETE_HTML_ELEMENT_RE.test(node.value)) {
99168
+ const hasInnerText = node.value.replace(HTML_TAG_STRIP_RE, '').trim().length > 0;
99169
+ if (hasInnerText) {
99162
99170
  node.value = processMarkdownInHtmlString(node.value);
99163
99171
  }
99164
99172
  else {
@@ -101547,8 +101555,7 @@ function tokenizeJsxTable(effects, ok, nok) {
101547
101555
  let codeSpanOpenSize = 0;
101548
101556
  let codeSpanCloseSize = 0;
101549
101557
  let depth = 1;
101550
- const TABLE_NAME = [codes.uppercaseT, codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
101551
- const ABLE_SUFFIX = TABLE_NAME.slice(1);
101558
+ const ABLE_SUFFIX = [codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
101552
101559
  /** Build a state chain that matches a sequence of character codes. */
101553
101560
  function matchChars(chars, onMatch, onFail) {
101554
101561
  if (chars.length === 0)
@@ -101568,7 +101575,14 @@ function tokenizeJsxTable(effects, ok, nok) {
101568
101575
  effects.enter('jsxTable');
101569
101576
  effects.enter('jsxTableData');
101570
101577
  effects.consume(code);
101571
- return matchChars(TABLE_NAME, afterTagName, nok);
101578
+ return afterLessThan;
101579
+ }
101580
+ function afterLessThan(code) {
101581
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
101582
+ effects.consume(code);
101583
+ return matchChars(ABLE_SUFFIX, afterTagName, nok);
101584
+ }
101585
+ return nok(code);
101572
101586
  }
101573
101587
  function afterTagName(code) {
101574
101588
  if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
@@ -101640,14 +101654,21 @@ function tokenizeJsxTable(effects, ok, nok) {
101640
101654
  function closeSlash(code) {
101641
101655
  if (code === codes.slash) {
101642
101656
  effects.consume(code);
101643
- return matchChars(TABLE_NAME, closeGt, body);
101657
+ return closeTagFirstChar;
101644
101658
  }
101645
- if (code === codes.uppercaseT) {
101659
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
101646
101660
  effects.consume(code);
101647
101661
  return matchChars(ABLE_SUFFIX, openAfterTagName, body);
101648
101662
  }
101649
101663
  return body(code);
101650
101664
  }
101665
+ function closeTagFirstChar(code) {
101666
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
101667
+ effects.consume(code);
101668
+ return matchChars(ABLE_SUFFIX, closeGt, body);
101669
+ }
101670
+ return body(code);
101671
+ }
101651
101672
  function openAfterTagName(code) {
101652
101673
  if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
101653
101674
  depth += 1;
@@ -101723,10 +101744,10 @@ function jsx_table_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
101723
101744
  }
101724
101745
  }
101725
101746
  /**
101726
- * Micromark extension that tokenizes `<Table>...</Table>` as a single flow block.
101747
+ * Micromark extension that tokenizes `<Table>...</Table>` and `<table>...</table>`
101748
+ * as a single flow block.
101727
101749
  *
101728
- * Prevents CommonMark HTML block type 6 from matching `<Table>` (case-insensitive
101729
- * match against `table`) and fragmenting it at blank lines.
101750
+ * Prevents CommonMark HTML block type 6 from fragmenting table blocks at blank lines.
101730
101751
  */
101731
101752
  function jsxTable() {
101732
101753
  return {
package/dist/main.node.js CHANGED
@@ -73519,9 +73519,16 @@ function formatHtmlForMdxish(html) {
73519
73519
  }
73520
73520
  // Removes the leading/trailing newlines
73521
73521
  let cleaned = processed.replace(/^\s*\n|\n\s*$/g, '');
73522
- // Convert literal \n sequences to actual newlines BEFORE processing backticks
73523
- // This prevents the backtick unescaping regex from incorrectly matching \n sequences
73524
- cleaned = cleaned.replace(/\\n/g, '\n');
73522
+ // Convert literal \n sequences to actual newlines only inside <pre> and <code>.
73523
+ // Because <pre> needs to respect the newline visual and
73524
+ // escape characters should be processed in the <code> tag.
73525
+ //
73526
+ // We don't want to unescape every \n because it might break the HTML & cause errors
73527
+ // Example: <script>console.log("\n");</script>
73528
+ // Would get turned into: <script>console.log("
73529
+ // ");</script>
73530
+ // which is invalid javascript and will cause error
73531
+ cleaned = cleaned.replace(/(<(pre|code)\b[^>]*>)([\s\S]*?)(<\/\2>)/gi, (_m, open, _tag, inner, close) => open + inner.replace(/\\n/g, '\n') + close);
73525
73532
  // Unescape backticks: \` -> ` (users escape backticks in template literals)
73526
73533
  // Handle both cases: \` (adjacent) and \ followed by ` (split by markdown parser)
73527
73534
  cleaned = cleaned.replace(/\\`/g, '`');
@@ -92101,7 +92108,7 @@ const hasFlowContent = (nodes) => {
92101
92108
  * a markdown table (phrasing-only) or keep as JSX <Table> (has flow content).
92102
92109
  */
92103
92110
  const processTableNode = (node, index, parent, documentPosition) => {
92104
- if (node.name !== 'Table')
92111
+ if (node.name !== 'Table' && node.name !== 'table')
92105
92112
  return;
92106
92113
  const position = documentPosition ?? node.position;
92107
92114
  const { align: alignAttr } = getAttrs(node);
@@ -92215,7 +92222,7 @@ const mdxishTables = () => tree => {
92215
92222
  const node = _node;
92216
92223
  if (typeof index !== 'number' || !parent || !('children' in parent))
92217
92224
  return;
92218
- if (!node.value.startsWith('<Table'))
92225
+ if (!node.value.startsWith('<Table') && !node.value.startsWith('<table'))
92219
92226
  return;
92220
92227
  try {
92221
92228
  const parsed = tableNodeProcessor.runSync(tableNodeProcessor.parse(node.value));
@@ -92237,13 +92244,10 @@ const mdxishTables = () => tree => {
92237
92244
  }
92238
92245
  });
92239
92246
  visit(parsed, isMDXElement, (tableNode) => {
92240
- if (tableNode.name === 'Table') {
92241
- processTableNode(tableNode, index, parent, node.position);
92242
- // Stop after the outermost Table so nested Tables don't overwrite parent.children[index]
92243
- // we let it get handled naturally
92244
- return EXIT;
92245
- }
92246
- return undefined;
92247
+ if (tableNode.name !== 'Table' && tableNode.name !== 'table')
92248
+ return undefined;
92249
+ processTableNode(tableNode, index, parent, node.position);
92250
+ return EXIT;
92247
92251
  });
92248
92252
  }
92249
92253
  catch {
@@ -104999,6 +105003,63 @@ function rehypeSanitize(options) {
104999
105003
  }
105000
105004
  }
105001
105005
 
105006
+ ;// ./node_modules/mdast-util-newline-to-break/lib/index.js
105007
+ /**
105008
+ * @typedef {import('mdast').Nodes} Nodes
105009
+ * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction
105010
+ */
105011
+
105012
+
105013
+
105014
+ /**
105015
+ * Turn normal line endings into hard breaks.
105016
+ *
105017
+ * @param {Nodes} tree
105018
+ * Tree to change.
105019
+ * @returns {undefined}
105020
+ * Nothing.
105021
+ */
105022
+ function newlineToBreak(tree) {
105023
+ findAndReplace(tree, [/\r?\n|\r/g, lib_replace])
105024
+ }
105025
+
105026
+ /**
105027
+ * Replace line endings.
105028
+ *
105029
+ * @type {ReplaceFunction}
105030
+ */
105031
+ function lib_replace() {
105032
+ return {type: 'break'}
105033
+ }
105034
+
105035
+ ;// ./node_modules/remark-breaks/lib/index.js
105036
+ /**
105037
+ * @typedef {import('mdast').Root} Root
105038
+ */
105039
+
105040
+
105041
+
105042
+ /**
105043
+ * Support hard breaks without needing spaces or escapes (turns enters into
105044
+ * `<br>`s).
105045
+ *
105046
+ * @returns
105047
+ * Transform.
105048
+ */
105049
+ function remarkBreaks() {
105050
+ /**
105051
+ * Transform.
105052
+ *
105053
+ * @param {Root} tree
105054
+ * Tree.
105055
+ * @returns {undefined}
105056
+ * Nothing.
105057
+ */
105058
+ return function (tree) {
105059
+ newlineToBreak(tree)
105060
+ }
105061
+ }
105062
+
105002
105063
  ;// ./errors/mdx-syntax-error.ts
105003
105064
  class MdxSyntaxError extends SyntaxError {
105004
105065
  original = null;
@@ -107804,6 +107865,7 @@ const tocHastToMdx = (toc, components, variables) => {
107804
107865
 
107805
107866
 
107806
107867
 
107868
+
107807
107869
  const sanitizeSchema = cjs_default()(defaultSchema, {
107808
107870
  attributes: {
107809
107871
  a: ['target'],
@@ -107812,12 +107874,13 @@ const sanitizeSchema = cjs_default()(defaultSchema, {
107812
107874
  href: ['doc', 'ref', 'blog', 'changelog', 'page'],
107813
107875
  },
107814
107876
  });
107815
- const compile_compile = (text, { components = {}, missingComponents, copyButtons, useTailwind, ...opts } = {}) => {
107877
+ const compile_compile = (text, { components = {}, missingComponents, copyButtons, useTailwind, hardBreaks, ...opts } = {}) => {
107816
107878
  // Destructure at runtime to avoid circular dependency issues
107817
107879
  const { codeTabsTransformer, ...transforms } = defaultTransforms;
107818
107880
  const remarkPlugins = [
107819
107881
  remarkFrontmatter,
107820
107882
  remarkGfm,
107883
+ ...(hardBreaks ? [remarkBreaks] : []),
107821
107884
  ...Object.values(transforms),
107822
107885
  [codeTabsTransformer, { copyButtons }],
107823
107886
  [
@@ -114223,63 +114286,6 @@ function rehypeStringify(options) {
114223
114286
  }
114224
114287
  }
114225
114288
 
114226
- ;// ./node_modules/mdast-util-newline-to-break/lib/index.js
114227
- /**
114228
- * @typedef {import('mdast').Nodes} Nodes
114229
- * @typedef {import('mdast-util-find-and-replace').ReplaceFunction} ReplaceFunction
114230
- */
114231
-
114232
-
114233
-
114234
- /**
114235
- * Turn normal line endings into hard breaks.
114236
- *
114237
- * @param {Nodes} tree
114238
- * Tree to change.
114239
- * @returns {undefined}
114240
- * Nothing.
114241
- */
114242
- function newlineToBreak(tree) {
114243
- findAndReplace(tree, [/\r?\n|\r/g, lib_replace])
114244
- }
114245
-
114246
- /**
114247
- * Replace line endings.
114248
- *
114249
- * @type {ReplaceFunction}
114250
- */
114251
- function lib_replace() {
114252
- return {type: 'break'}
114253
- }
114254
-
114255
- ;// ./node_modules/remark-breaks/lib/index.js
114256
- /**
114257
- * @typedef {import('mdast').Root} Root
114258
- */
114259
-
114260
-
114261
-
114262
- /**
114263
- * Support hard breaks without needing spaces or escapes (turns enters into
114264
- * `<br>`s).
114265
- *
114266
- * @returns
114267
- * Transform.
114268
- */
114269
- function remarkBreaks() {
114270
- /**
114271
- * Transform.
114272
- *
114273
- * @param {Root} tree
114274
- * Tree.
114275
- * @returns {undefined}
114276
- * Nothing.
114277
- */
114278
- return function (tree) {
114279
- newlineToBreak(tree)
114280
- }
114281
- }
114282
-
114283
114289
  ;// ./processor/plugin/flatten-table-cell-paragraphs.ts
114284
114290
 
114285
114291
  /** List elements that cause margin issues when adjacent to paragraphs */
@@ -119108,8 +119114,8 @@ const HTML_ELEMENT_BLOCK_RE = /<([a-zA-Z][a-zA-Z0-9-]*)[\s>][\s\S]*?<\/\1>/g;
119108
119114
  const NEWLINE_WITH_WHITESPACE_RE = /[^\S\n]*\n[^\S\n]*/g;
119109
119115
  /** Matches a closing block-level tag followed by non-tag text or by a newline then non-blank content. */
119110
119116
  const CLOSE_BLOCK_TAG_BOUNDARY_RE = /<\/([a-zA-Z][a-zA-Z0-9-]*)>\s*(?:(?!<)(\S)|\n([^\n]))/g;
119111
- /** Tests whether a string contains a complete HTML element (open + close tag). */
119112
- const COMPLETE_HTML_ELEMENT_RE = /<[a-zA-Z][^>]*>[\s\S]*<\/[a-zA-Z]/;
119117
+ /** Strips HTML open/close tags. Used to detect non-tag inner text content. */
119118
+ const HTML_TAG_STRIP_RE = /<\/?[a-zA-Z][^>]*>/g;
119113
119119
 
119114
119120
  ;// ./processor/transform/mdxish/magic-blocks/placeholder.ts
119115
119121
  const EMPTY_IMAGE_PLACEHOLDER = {
@@ -119349,10 +119355,12 @@ const parseTableCell = (text) => {
119349
119355
  const trimmedLines = normalized.split('\n').map(line => line.trimStart());
119350
119356
  const processed = trimmedLines.join('\n');
119351
119357
  const tree = contentParser.runSync(contentParser.parse(processed));
119352
- // Process markdown inside complete HTML elements (e.g. _emphasis_ within <li>).
119353
- // Bare tags like "<i>" are left for rehypeRaw since rehype-parse would mangle them.
119358
+ // Process markdown inside HTML blocks that have non-tag inner text (e.g. `<div>**x**`
119359
+ // or `<ul><li>_x_</li></ul>`). Pure bare tags like "<i>" or "<br>" are left for rehypeRaw
119360
+ // since rehype-parse would mangle them (auto-closing void/inline elements).
119354
119361
  visit(tree, 'html', (node) => {
119355
- if (COMPLETE_HTML_ELEMENT_RE.test(node.value)) {
119362
+ const hasInnerText = node.value.replace(HTML_TAG_STRIP_RE, '').trim().length > 0;
119363
+ if (hasInnerText) {
119356
119364
  node.value = processMarkdownInHtmlString(node.value);
119357
119365
  }
119358
119366
  else {
@@ -121741,8 +121749,7 @@ function tokenizeJsxTable(effects, ok, nok) {
121741
121749
  let codeSpanOpenSize = 0;
121742
121750
  let codeSpanCloseSize = 0;
121743
121751
  let depth = 1;
121744
- const TABLE_NAME = [codes.uppercaseT, codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
121745
- const ABLE_SUFFIX = TABLE_NAME.slice(1);
121752
+ const ABLE_SUFFIX = [codes.lowercaseA, codes.lowercaseB, codes.lowercaseL, codes.lowercaseE];
121746
121753
  /** Build a state chain that matches a sequence of character codes. */
121747
121754
  function matchChars(chars, onMatch, onFail) {
121748
121755
  if (chars.length === 0)
@@ -121762,7 +121769,14 @@ function tokenizeJsxTable(effects, ok, nok) {
121762
121769
  effects.enter('jsxTable');
121763
121770
  effects.enter('jsxTableData');
121764
121771
  effects.consume(code);
121765
- return matchChars(TABLE_NAME, afterTagName, nok);
121772
+ return afterLessThan;
121773
+ }
121774
+ function afterLessThan(code) {
121775
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
121776
+ effects.consume(code);
121777
+ return matchChars(ABLE_SUFFIX, afterTagName, nok);
121778
+ }
121779
+ return nok(code);
121766
121780
  }
121767
121781
  function afterTagName(code) {
121768
121782
  if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
@@ -121834,14 +121848,21 @@ function tokenizeJsxTable(effects, ok, nok) {
121834
121848
  function closeSlash(code) {
121835
121849
  if (code === codes.slash) {
121836
121850
  effects.consume(code);
121837
- return matchChars(TABLE_NAME, closeGt, body);
121851
+ return closeTagFirstChar;
121838
121852
  }
121839
- if (code === codes.uppercaseT) {
121853
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
121840
121854
  effects.consume(code);
121841
121855
  return matchChars(ABLE_SUFFIX, openAfterTagName, body);
121842
121856
  }
121843
121857
  return body(code);
121844
121858
  }
121859
+ function closeTagFirstChar(code) {
121860
+ if (code === codes.uppercaseT || code === codes.lowercaseT) {
121861
+ effects.consume(code);
121862
+ return matchChars(ABLE_SUFFIX, closeGt, body);
121863
+ }
121864
+ return body(code);
121865
+ }
121845
121866
  function openAfterTagName(code) {
121846
121867
  if (code === codes.greaterThan || code === codes.slash || code === codes.space || code === codes.horizontalTab) {
121847
121868
  depth += 1;
@@ -121917,10 +121938,10 @@ function jsx_table_syntax_tokenizeNonLazyContinuationStart(effects, ok, nok) {
121917
121938
  }
121918
121939
  }
121919
121940
  /**
121920
- * Micromark extension that tokenizes `<Table>...</Table>` as a single flow block.
121941
+ * Micromark extension that tokenizes `<Table>...</Table>` and `<table>...</table>`
121942
+ * as a single flow block.
121921
121943
  *
121922
- * Prevents CommonMark HTML block type 6 from matching `<Table>` (case-insensitive
121923
- * match against `table`) and fragmenting it at blank lines.
121944
+ * Prevents CommonMark HTML block type 6 from fragmenting table blocks at blank lines.
121924
121945
  */
121925
121946
  function jsxTable() {
121926
121947
  return {