@readme/markdown 14.11.3 → 14.11.5

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.
@@ -0,0 +1,4 @@
1
+ import type { Parents, Text } from 'mdast';
2
+ import type { Info, State } from 'mdast-util-to-markdown';
3
+ declare const text: (node: Text, parent: Parents | undefined, state: State, info: Info) => string;
4
+ export default text;
@@ -0,0 +1,8 @@
1
+ import type { ElementContent } from 'hast';
2
+ /**
3
+ * Convert a React element tree into hast. Emitting `mdx-jsx` nodes (rehypeRaw passthrough, later normalized to `element`)
4
+ * preserves nesting that is valid JSX but not valid HTML, which parse5 would otherwise
5
+ * restructure — e.g. an `<a>` wrapping another `<a>`.
6
+ * Recursively converts the tree into an array of hast nodes, dealing with arrays and null/undefined/boolean values.
7
+ */
8
+ export declare function reactElementToHast(node: unknown): ElementContent[];
@@ -0,0 +1,15 @@
1
+ import { type RepairResult } from './utils';
2
+ /**
3
+ * mdxjs rejects a table when a markdown emphasis run opens at one HTML
4
+ * tag-nesting depth and closes at another — e.g. `_<ul><li>text_</li></ul>`,
5
+ * where the `_` opens outside the list but closes inside a `<li>`. It throws
6
+ * "Expected a closing tag for `<li>` before the end of `emphasis`" and the
7
+ * whole `<Table>` fails to parse.
8
+ *
9
+ * We walk tags and emphasis together, tracking tag depth and a stack of open
10
+ * emphasis. A delimiter only closes an opener at the same depth; any emphasis
11
+ * still open when its enclosing tag closes (or at end of input), and any closer
12
+ * with no same-depth opener, is escaped so mdxjs treats it as literal text.
13
+ * Scoped to the malformed-retry path.
14
+ */
15
+ export declare const escapeCrossingEmphasis: (html: string) => RepairResult;
@@ -1,9 +1,7 @@
1
1
  import type { Insert } from './utils';
2
2
  import type { Node } from 'mdast';
3
3
  /**
4
- * Walk `tree`, translating every node's position from the repaired source's
5
- * coordinate space back to the original source. Offsets are remapped via the
6
- * insert list; line/column are recomputed from the original source so they
7
- * remain accurate even if repairs introduced newlines.
4
+ * Remap positions produced after a chain of repairs (each applied to the prior
5
+ * one's output) back to the original source coordinates.
8
6
  */
9
- export declare const remapPositionsToOriginal: (tree: Node, originalSource: string, inserts: Insert[]) => void;
7
+ export declare const remapPositionsThroughLayers: (tree: Node, originalSource: string, layers: Insert[][]) => void;
@@ -0,0 +1,11 @@
1
+ import type { Html } from 'mdast';
2
+ /**
3
+ * Given an HTML node that might contain table sequences inside it, split
4
+ * the node based on the table boundaries so they become a top level node.
5
+ *
6
+ * The surrounding raw HTML (the wrapper's open/close tags) would be re-nested
7
+ * around the parsed tables by rehype-raw.
8
+ *
9
+ * Returns null when there is no wrapped table to extract.
10
+ */
11
+ export declare const splitHtmlWithNestedTables: (node: Html) => Html[] | null;
@@ -1,22 +1,8 @@
1
1
  /**
2
- * Preprocessor to terminate HTML flow blocks.
3
- *
4
- * In CommonMark, HTML blocks (types 6 and 7) only terminate on a blank line.
5
- * Without one, any content on the next line is consumed as part of the HTML block
6
- * and never parsed as its own construct. For example, a `[block:callout]` immediately
7
- * following `<div><p></p></div>` gets swallowed into the HTML flow token.
2
+ * CommonMark HTML blocks (types 6/7) end only at a blank line, so markdown on the
3
+ * next line is swallowed as HTML (`## heading` after `<div>` renders as literal text).
4
+ * Inserts the missing blank line; the gating rules live in `shouldTerminateBetween`.
8
5
  *
9
6
  * @link https://spec.commonmark.org/0.29/#html-blocks
10
- *
11
- * This preprocessor inserts a blank line after standalone HTML lines when the next
12
- * line is non-blank and not an HTML construct, ensuring micromark's HTML flow
13
- * tokenizer terminates and subsequent content is parsed independently.
14
- *
15
- * Conditions:
16
- * 1. Only non-indented lines with lowercase tag names are considered. Uppercase tags
17
- * (e.g. `<Table>`, `<MyComponent>`) are JSX custom components and don't trigger
18
- * CommonMark HTML blocks.
19
- * 2. Lines inside protected blocks (e.g. fenced code) are left untouched.
20
- * 3. Lines with an unclosed RAW_CONTENT_TAGS opener are exempted.
21
7
  */
22
8
  export declare function terminateHtmlFlowBlocks(content: string): string;
@@ -2,6 +2,7 @@ import type { Root as HastRoot } from 'hast';
2
2
  import type { Node, Root as MdastRoot, Root } from 'mdast';
3
3
  import type { MdxJsxFlowElement, MdxJsxTextElement, MdxjsEsm } from 'mdast-util-mdx';
4
4
  import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
5
+ import type { Point } from 'unist';
5
6
  import { Parser } from 'acorn';
6
7
  /**
7
8
  * Single instance of acorn parser extended with `acorn-jsx`
@@ -24,6 +25,12 @@ export declare const jsxAcornParser: typeof Parser;
24
25
  * Throws on parse/runtime error; callers decide the fallback.
25
26
  */
26
27
  export declare function evaluate(source: string, scope?: Record<string, unknown>): any;
28
+ /**
29
+ * Advance a `Point` by the `consumed` substring that follows it, returning the
30
+ * point at the consumed string's end. Lets split-out sub-nodes carry accurate
31
+ * document positions so downstream offset shifting stays correct.
32
+ */
33
+ export declare const pointAfter: (start: Point, consumed: string) => Point;
27
34
  /**
28
35
  * Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
29
36
  * This currently sets all the values to a string since we process/compile the MDX on the fly