@readme/markdown 15.8.0 → 15.9.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/components/Callout/style.scss +8 -0
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +351 -149
- package/dist/main.node.js +351 -149
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/components/utils.d.ts +0 -7
- package/dist/processor/transform/mdxish/reparse-source.d.ts +18 -0
- package/dist/processor/transform/mdxish/tables/cell-style.d.ts +7 -0
- package/dist/processor/transform/mdxish/tables/cell-width.d.ts +9 -0
- package/dist/processor/transform/mdxish/tables/mdxish-tables.d.ts +3 -2
- package/dist/processor/transform/mdxish/tables/split-nested-tables.d.ts +3 -2
- package/dist/processor/utils.d.ts +4 -5
- package/dist/render-fixture.node.js +330 -150
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +2 -0
|
@@ -10,13 +10,6 @@ export type MdxAttributes = (MdxJsxAttribute | MdxJsxExpressionAttribute)[];
|
|
|
10
10
|
export declare const getInlineMdProcessor: ({ safeMode }?: {
|
|
11
11
|
safeMode?: boolean;
|
|
12
12
|
}) => import("unified").Processor<import("mdast").Root, undefined, undefined, undefined, undefined>;
|
|
13
|
-
/**
|
|
14
|
-
* Mark re-parsed subtree roots with the string their positions index into, so consumers
|
|
15
|
-
* slicing by offset use the right source (see `Data.reparseSource`). Only roots are
|
|
16
|
-
* stamped; descendants resolve via their nearest stamped ancestor. Roots a deeper
|
|
17
|
-
* re-parse already stamped keep their own string.
|
|
18
|
-
*/
|
|
19
|
-
export declare const stampReparseSource: (roots: Node[], reparseSource: string) => void;
|
|
20
13
|
/**
|
|
21
14
|
* True when a tag name starts with an uppercase letter — ReadMe's marker for
|
|
22
15
|
* a custom MDX component (vs a lowercase HTML tag).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Node, Parent } from 'mdast';
|
|
2
|
+
/**
|
|
3
|
+
* Mark re-parsed subtree roots with the string their positions index into, so consumers
|
|
4
|
+
* slicing by offset use the right source (see `Data.reparseSource`). Only roots are
|
|
5
|
+
* stamped; descendants resolve via their nearest stamped ancestor. Roots a deeper
|
|
6
|
+
* re-parse already stamped keep their own string.
|
|
7
|
+
*/
|
|
8
|
+
export declare const stampReparseSource: (roots: Node[], reparseSource: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Splice `replacements` over `parent.children[index]`. They take over the replaced node's
|
|
11
|
+
* position, so they also take over the coordinate space that position indexes into.
|
|
12
|
+
*/
|
|
13
|
+
export declare const replaceInheritingReparseSource: (parent: Parent, index: number, replacements: Node[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* The string `node`'s offsets index into: the nearest stamp on it or an ancestor, else the
|
|
16
|
+
* document source.
|
|
17
|
+
*/
|
|
18
|
+
export declare const resolveReparseSource: (node: Node, ancestors: Node[], documentSource?: string) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
|
2
|
+
type CellAlign = 'center' | 'left' | 'right' | null;
|
|
3
|
+
/** `left` is the browser default, so it's omitted. Lowercase tables get the HTML string form. */
|
|
4
|
+
export declare const cellStyle: (align: CellAlign, width?: string | null, { html }?: {
|
|
5
|
+
html?: boolean;
|
|
6
|
+
}) => MdxJsxAttribute | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
2
|
+
/** Bare numbers are pixels. A value carrying declaration separators is not a single width. */
|
|
3
|
+
export declare const normalizeWidth: (value: unknown) => string | null;
|
|
4
|
+
/** Handles a CSS declaration list and a style object safe mode left as a string (`{ width: "30%" }`). */
|
|
5
|
+
export declare const widthFromStyleString: (style: string) => string | undefined;
|
|
6
|
+
/** Accepts `style={{ width }}`, `style="width: …"` and the hand-authored `width="…"`. */
|
|
7
|
+
export declare const getCellWidth: (cell: MdxJsxFlowElement | MdxJsxTextElement) => string | null;
|
|
8
|
+
/** True when the cell's attributes state nothing but its width, which mdast can carry. */
|
|
9
|
+
export declare const hasOnlyWidthAttributes: (cell: MdxJsxFlowElement | MdxJsxTextElement) => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
2
3
|
/**
|
|
3
4
|
* Converts JSX Table elements to markdown table nodes and re-parses markdown in cells.
|
|
4
5
|
*
|
|
@@ -10,5 +11,5 @@ import type { Transform } from 'mdast-util-from-markdown';
|
|
|
10
11
|
* When cell content contains block-level nodes (callouts, code blocks, etc.), the table
|
|
11
12
|
* is kept as a JSX <Table> element so that remarkRehype can properly handle the flow content.
|
|
12
13
|
*/
|
|
13
|
-
declare const mdxishTables:
|
|
14
|
+
declare const mdxishTables: Plugin<[], Root>;
|
|
14
15
|
export default mdxishTables;
|
|
@@ -6,6 +6,7 @@ import type { Html } from 'mdast';
|
|
|
6
6
|
* The surrounding raw HTML (the wrapper's open/close tags) would be re-nested
|
|
7
7
|
* around the parsed tables by rehype-raw.
|
|
8
8
|
*
|
|
9
|
-
* Returns null when there is no wrapped table to extract.
|
|
9
|
+
* Returns null when there is no wrapped table to extract. `source` is the string the node's
|
|
10
|
+
* positions index into, so the parts' positions survive stripped container prefixes.
|
|
10
11
|
*/
|
|
11
|
-
export declare const splitHtmlWithNestedTables: (node: Html) => Html[] | null;
|
|
12
|
+
export declare const splitHtmlWithNestedTables: (node: Html, source?: string) => Html[] | null;
|
|
@@ -2,7 +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
|
+
import type { Point, Position } from 'unist';
|
|
6
6
|
import { jsxAcornParser } from '../lib/utils/jsx-acorn-parser';
|
|
7
7
|
export { jsxAcornParser };
|
|
8
8
|
/**
|
|
@@ -22,11 +22,10 @@ export { jsxAcornParser };
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function evaluate(source: string, scope?: Record<string, unknown>): any;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* document positions so downstream offset shifting stays correct.
|
|
25
|
+
* Maps offsets in a node's `value` to points in `source`. Containers strip a prefix from every
|
|
26
|
+
* continuation line of `value`, so a plain offset shift drifts by line (CX-4028).
|
|
28
27
|
*/
|
|
29
|
-
export declare const
|
|
28
|
+
export declare const createValueToSourceMapper: (position: Position | undefined, value: string, source: string | null | undefined) => ((valueOffset: number) => Point) | null;
|
|
30
29
|
/**
|
|
31
30
|
* Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
|
|
32
31
|
* This currently sets all the values to a string since we process/compile the MDX on the fly
|