@readme/markdown 15.5.0 → 15.5.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 CHANGED
@@ -81629,6 +81629,17 @@ const tablesToJsx = () => tree => {
81629
81629
  ;// ./processor/transform/tailwind.tsx
81630
81630
 
81631
81631
 
81632
+
81633
+
81634
+ /** Whitespace-only text is layout between blocks, not inline flow. */
81635
+ const isInlineContent = (node) => phrasing(node) && !(node.type === 'text' && node.value.trim() === '');
81636
+ /**
81637
+ * Whether the child at `index` sits in inline flow: its parent only allows
81638
+ * phrasing content (e.g. a paragraph), or it is flanked by phrasing siblings
81639
+ * (e.g. `<div>text <Image /> text</div>`, whose children skip the paragraph).
81640
+ */
81641
+ const isInlineInContext = (index, parent) => INLINE_ONLY_PARENT_TYPES.has(parent.type) ||
81642
+ parent.children.some((sibling, siblingIndex) => siblingIndex !== index && isInlineContent(sibling));
81632
81643
  const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
81633
81644
  if (!('name' in node))
81634
81645
  return;
@@ -81637,7 +81648,7 @@ const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
81637
81648
  if (!('children' in parent))
81638
81649
  return;
81639
81650
  const attrs = {
81640
- flow: node.type === 'mdxJsxFlowElement',
81651
+ flow: node.type === 'mdxJsxFlowElement' && !isInlineInContext(index, parent),
81641
81652
  };
81642
81653
  const wrapper = {
81643
81654
  type: node.type,
@@ -107059,12 +107070,20 @@ function removeJSXComments(content) {
107059
107070
  const OPAQUE_CONTAINERS = new Set(['pre', 'textarea', 'htmlblock']);
107060
107071
  /** The missing-slash typo shape: an attribute-less, non-self-closing opener. */
107061
107072
  const BARE_OPENER_SOURCE_RE = /^<[A-Za-z]+\s*>$/;
107062
- /** The opener shares its line with nothing but whitespace. */
107063
- const isAloneOnLine = (content, start, end) => {
107064
- const lineStart = content.lastIndexOf('\n', start - 1) + 1;
107073
+ /** The opener is immediately preceded by a complete tag, so the prefix is markup and not prose. */
107074
+ const PREFIX_ENDS_WITH_TAG_RE = /<[^<>]*>\s*$/;
107075
+ /**
107076
+ * The opener finishes its line, preceded by nothing but whitespace or by markup.
107077
+ * Requiring markup (not merely "something") keeps a markdown block prefix such as
107078
+ * a `>` quote marker from qualifying, while allowing the closer to trail a cell or
107079
+ * `</thead>` on a single-line table.
107080
+ */
107081
+ const endsLineAfterMarkup = (content, start, end) => {
107065
107082
  const lineEnd = content.indexOf('\n', end);
107066
- return (content.slice(lineStart, start).trim() === '' &&
107067
- content.slice(end, lineEnd === -1 ? content.length : lineEnd).trim() === '');
107083
+ if (content.slice(end, lineEnd === -1 ? content.length : lineEnd).trim() !== '')
107084
+ return false;
107085
+ const prefix = content.slice(content.lastIndexOf('\n', start - 1) + 1, start);
107086
+ return prefix.trim() === '' || PREFIX_ENDS_WITH_TAG_RE.test(prefix);
107068
107087
  };
107069
107088
  /**
107070
107089
  * Rewrites a bare `<table>` that is almost certainly a missing-slash closer
@@ -107072,7 +107091,7 @@ const isAloneOnLine = (content, start, end) => {
107072
107091
  * Customer docs (CX-3850) close tables with a second bare opener; without this,
107073
107092
  * the never-terminated HTML flow block swallows the markdown that follows.
107074
107093
  *
107075
- * A candidate is a bare opener alone on its line while a table is already open.
107094
+ * A candidate is a bare opener that finishes its line while a table is already open.
107076
107095
  * It is judged a typo only when its element ends implicitly (no explicit
107077
107096
  * `</table>`) without ever acquiring table-structure children — so genuine
107078
107097
  * nested tables, whatever precedes their rows, are left alone.
@@ -107101,7 +107120,7 @@ function repairMistakenTableClosers(content) {
107101
107120
  start,
107102
107121
  end,
107103
107122
  hasStructureChild: false,
107104
- isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) && isAloneOnLine(content, start, end),
107123
+ isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) && endsLineAfterMarkup(content, start, end),
107105
107124
  });
107106
107125
  }
107107
107126
  else if (opaqueDepth === 0 && tableTags.has(lower) && stack.length > 0) {
package/dist/main.node.js CHANGED
@@ -101812,6 +101812,17 @@ const tablesToJsx = () => tree => {
101812
101812
  ;// ./processor/transform/tailwind.tsx
101813
101813
 
101814
101814
 
101815
+
101816
+
101817
+ /** Whitespace-only text is layout between blocks, not inline flow. */
101818
+ const isInlineContent = (node) => phrasing(node) && !(node.type === 'text' && node.value.trim() === '');
101819
+ /**
101820
+ * Whether the child at `index` sits in inline flow: its parent only allows
101821
+ * phrasing content (e.g. a paragraph), or it is flanked by phrasing siblings
101822
+ * (e.g. `<div>text <Image /> text</div>`, whose children skip the paragraph).
101823
+ */
101824
+ const isInlineInContext = (index, parent) => INLINE_ONLY_PARENT_TYPES.has(parent.type) ||
101825
+ parent.children.some((sibling, siblingIndex) => siblingIndex !== index && isInlineContent(sibling));
101815
101826
  const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
101816
101827
  if (!('name' in node))
101817
101828
  return;
@@ -101820,7 +101831,7 @@ const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
101820
101831
  if (!('children' in parent))
101821
101832
  return;
101822
101833
  const attrs = {
101823
- flow: node.type === 'mdxJsxFlowElement',
101834
+ flow: node.type === 'mdxJsxFlowElement' && !isInlineInContext(index, parent),
101824
101835
  };
101825
101836
  const wrapper = {
101826
101837
  type: node.type,
@@ -127242,12 +127253,20 @@ function removeJSXComments(content) {
127242
127253
  const OPAQUE_CONTAINERS = new Set(['pre', 'textarea', 'htmlblock']);
127243
127254
  /** The missing-slash typo shape: an attribute-less, non-self-closing opener. */
127244
127255
  const BARE_OPENER_SOURCE_RE = /^<[A-Za-z]+\s*>$/;
127245
- /** The opener shares its line with nothing but whitespace. */
127246
- const isAloneOnLine = (content, start, end) => {
127247
- const lineStart = content.lastIndexOf('\n', start - 1) + 1;
127256
+ /** The opener is immediately preceded by a complete tag, so the prefix is markup and not prose. */
127257
+ const PREFIX_ENDS_WITH_TAG_RE = /<[^<>]*>\s*$/;
127258
+ /**
127259
+ * The opener finishes its line, preceded by nothing but whitespace or by markup.
127260
+ * Requiring markup (not merely "something") keeps a markdown block prefix such as
127261
+ * a `>` quote marker from qualifying, while allowing the closer to trail a cell or
127262
+ * `</thead>` on a single-line table.
127263
+ */
127264
+ const endsLineAfterMarkup = (content, start, end) => {
127248
127265
  const lineEnd = content.indexOf('\n', end);
127249
- return (content.slice(lineStart, start).trim() === '' &&
127250
- content.slice(end, lineEnd === -1 ? content.length : lineEnd).trim() === '');
127266
+ if (content.slice(end, lineEnd === -1 ? content.length : lineEnd).trim() !== '')
127267
+ return false;
127268
+ const prefix = content.slice(content.lastIndexOf('\n', start - 1) + 1, start);
127269
+ return prefix.trim() === '' || PREFIX_ENDS_WITH_TAG_RE.test(prefix);
127251
127270
  };
127252
127271
  /**
127253
127272
  * Rewrites a bare `<table>` that is almost certainly a missing-slash closer
@@ -127255,7 +127274,7 @@ const isAloneOnLine = (content, start, end) => {
127255
127274
  * Customer docs (CX-3850) close tables with a second bare opener; without this,
127256
127275
  * the never-terminated HTML flow block swallows the markdown that follows.
127257
127276
  *
127258
- * A candidate is a bare opener alone on its line while a table is already open.
127277
+ * A candidate is a bare opener that finishes its line while a table is already open.
127259
127278
  * It is judged a typo only when its element ends implicitly (no explicit
127260
127279
  * `</table>`) without ever acquiring table-structure children — so genuine
127261
127280
  * nested tables, whatever precedes their rows, are left alone.
@@ -127284,7 +127303,7 @@ function repairMistakenTableClosers(content) {
127284
127303
  start,
127285
127304
  end,
127286
127305
  hasStructureChild: false,
127287
- isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) && isAloneOnLine(content, start, end),
127306
+ isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) && endsLineAfterMarkup(content, start, end),
127288
127307
  });
127289
127308
  }
127290
127309
  else if (opaqueDepth === 0 && tableTags.has(lower) && stack.length > 0) {