@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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Customer docs (CX-3850) close tables with a second bare opener; without this,
|
|
5
5
|
* the never-terminated HTML flow block swallows the markdown that follows.
|
|
6
6
|
*
|
|
7
|
-
* A candidate is a bare opener
|
|
7
|
+
* A candidate is a bare opener that finishes its line while a table is already open.
|
|
8
8
|
* It is judged a typo only when its element ends implicitly (no explicit
|
|
9
9
|
* `</table>`) without ever acquiring table-structure children — so genuine
|
|
10
10
|
* nested tables, whatever precedes their rows, are left alone.
|
|
@@ -101758,6 +101758,17 @@ const tablesToJsx = () => tree => {
|
|
|
101758
101758
|
;// ./processor/transform/tailwind.tsx
|
|
101759
101759
|
|
|
101760
101760
|
|
|
101761
|
+
|
|
101762
|
+
|
|
101763
|
+
/** Whitespace-only text is layout between blocks, not inline flow. */
|
|
101764
|
+
const isInlineContent = (node) => phrasing(node) && !(node.type === 'text' && node.value.trim() === '');
|
|
101765
|
+
/**
|
|
101766
|
+
* Whether the child at `index` sits in inline flow: its parent only allows
|
|
101767
|
+
* phrasing content (e.g. a paragraph), or it is flanked by phrasing siblings
|
|
101768
|
+
* (e.g. `<div>text <Image /> text</div>`, whose children skip the paragraph).
|
|
101769
|
+
*/
|
|
101770
|
+
const isInlineInContext = (index, parent) => INLINE_ONLY_PARENT_TYPES.has(parent.type) ||
|
|
101771
|
+
parent.children.some((sibling, siblingIndex) => siblingIndex !== index && isInlineContent(sibling));
|
|
101761
101772
|
const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
|
|
101762
101773
|
if (!('name' in node))
|
|
101763
101774
|
return;
|
|
@@ -101766,7 +101777,7 @@ const injectTailwindRoot = ({ components = {} }) => (node, index, parent) => {
|
|
|
101766
101777
|
if (!('children' in parent))
|
|
101767
101778
|
return;
|
|
101768
101779
|
const attrs = {
|
|
101769
|
-
flow: node.type === 'mdxJsxFlowElement',
|
|
101780
|
+
flow: node.type === 'mdxJsxFlowElement' && !isInlineInContext(index, parent),
|
|
101770
101781
|
};
|
|
101771
101782
|
const wrapper = {
|
|
101772
101783
|
type: node.type,
|
|
@@ -127006,12 +127017,20 @@ function removeJSXComments(content) {
|
|
|
127006
127017
|
const OPAQUE_CONTAINERS = new Set(['pre', 'textarea', 'htmlblock']);
|
|
127007
127018
|
/** The missing-slash typo shape: an attribute-less, non-self-closing opener. */
|
|
127008
127019
|
const BARE_OPENER_SOURCE_RE = /^<[A-Za-z]+\s*>$/;
|
|
127009
|
-
/** The opener
|
|
127010
|
-
const
|
|
127011
|
-
|
|
127020
|
+
/** The opener is immediately preceded by a complete tag, so the prefix is markup and not prose. */
|
|
127021
|
+
const PREFIX_ENDS_WITH_TAG_RE = /<[^<>]*>\s*$/;
|
|
127022
|
+
/**
|
|
127023
|
+
* The opener finishes its line, preceded by nothing but whitespace or by markup.
|
|
127024
|
+
* Requiring markup (not merely "something") keeps a markdown block prefix such as
|
|
127025
|
+
* a `>` quote marker from qualifying, while allowing the closer to trail a cell or
|
|
127026
|
+
* `</thead>` on a single-line table.
|
|
127027
|
+
*/
|
|
127028
|
+
const endsLineAfterMarkup = (content, start, end) => {
|
|
127012
127029
|
const lineEnd = content.indexOf('\n', end);
|
|
127013
|
-
|
|
127014
|
-
|
|
127030
|
+
if (content.slice(end, lineEnd === -1 ? content.length : lineEnd).trim() !== '')
|
|
127031
|
+
return false;
|
|
127032
|
+
const prefix = content.slice(content.lastIndexOf('\n', start - 1) + 1, start);
|
|
127033
|
+
return prefix.trim() === '' || PREFIX_ENDS_WITH_TAG_RE.test(prefix);
|
|
127015
127034
|
};
|
|
127016
127035
|
/**
|
|
127017
127036
|
* Rewrites a bare `<table>` that is almost certainly a missing-slash closer
|
|
@@ -127019,7 +127038,7 @@ const isAloneOnLine = (content, start, end) => {
|
|
|
127019
127038
|
* Customer docs (CX-3850) close tables with a second bare opener; without this,
|
|
127020
127039
|
* the never-terminated HTML flow block swallows the markdown that follows.
|
|
127021
127040
|
*
|
|
127022
|
-
* A candidate is a bare opener
|
|
127041
|
+
* A candidate is a bare opener that finishes its line while a table is already open.
|
|
127023
127042
|
* It is judged a typo only when its element ends implicitly (no explicit
|
|
127024
127043
|
* `</table>`) without ever acquiring table-structure children — so genuine
|
|
127025
127044
|
* nested tables, whatever precedes their rows, are left alone.
|
|
@@ -127048,7 +127067,7 @@ function repairMistakenTableClosers(content) {
|
|
|
127048
127067
|
start,
|
|
127049
127068
|
end,
|
|
127050
127069
|
hasStructureChild: false,
|
|
127051
|
-
isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) &&
|
|
127070
|
+
isCandidate: stack.length > 0 && BARE_OPENER_SOURCE_RE.test(source) && endsLineAfterMarkup(content, start, end),
|
|
127052
127071
|
});
|
|
127053
127072
|
}
|
|
127054
127073
|
else if (opaqueDepth === 0 && tableTags.has(lower) && stack.length > 0) {
|