@readme/markdown 14.0.0 → 14.1.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/example/components.d.ts +1 -0
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/mdxish.d.ts +0 -2
- package/dist/lib/micromark/mdx-component/syntax.d.ts +17 -10
- package/dist/lib/utils/mdxish/mdxish-component-tag-parser.d.ts +33 -0
- package/dist/main.js +3853 -3557
- package/dist/main.node.js +3852 -3556
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/components/inline-html.d.ts +22 -0
- package/dist/processor/transform/mdxish/{mdxish-inline-components.d.ts → components/inline-mdx-blocks.d.ts} +3 -3
- package/dist/processor/transform/mdxish/{mdxish-component-blocks.d.ts → components/mdx-blocks.d.ts} +5 -18
- package/dist/processor/transform/mdxish/components/utils.d.ts +29 -0
- package/dist/processor/transform/mdxish/evaluate-expressions.d.ts +5 -5
- package/dist/processor/transform/mdxish/normalize-mdx-jsx-nodes.d.ts +15 -0
- package/dist/processor/transform/mdxish/preprocess-jsx-expressions.d.ts +6 -24
- package/dist/processor/transform/mdxish/restore-snake-case-component-name.d.ts +1 -1
- package/dist/processor/utils.d.ts +14 -0
- package/package.json +1 -1
- package/types.d.ts +26 -1
- /package/dist/processor/transform/mdxish/{mdxish-self-closing-blocks.d.ts → components/self-closing-blocks.d.ts} +0 -0
- /package/dist/processor/transform/mdxish/{mdxish-snake-case-components.d.ts → components/snake-case-components.d.ts} +0 -0
package/dist/lib/constants.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const FLOW_TYPES: Set<string>;
|
|
|
15
15
|
* paragraph nodes. Excluding them from the generic `mdxComponent` micromark
|
|
16
16
|
* construct lets the dedicated inline transformer handle them instead.
|
|
17
17
|
*
|
|
18
|
-
* @see processor/transform/mdxish/
|
|
18
|
+
* @see processor/transform/mdxish/components/inline-mdx-blocks.ts
|
|
19
19
|
*/
|
|
20
20
|
export declare const INLINE_COMPONENT_TAGS: Set<string>;
|
|
21
21
|
/**
|
package/dist/lib/mdxish.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { CustomComponents, Variables } from '../types';
|
|
2
2
|
import type { Root } from 'hast';
|
|
3
3
|
import type { Root as MdastRoot } from 'mdast';
|
|
4
|
-
import { type JSXContext } from '../processor/transform/mdxish/preprocess-jsx-expressions';
|
|
5
4
|
export interface MdxishOpts {
|
|
6
5
|
components?: CustomComponents;
|
|
7
|
-
jsxContext?: JSXContext;
|
|
8
6
|
newEditorTypes?: boolean;
|
|
9
7
|
/**
|
|
10
8
|
* When enabled, the pipeline ignores all expression syntax `{...}`.
|
|
@@ -6,18 +6,25 @@ declare module 'micromark-util-types' {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Micromark extension that tokenizes
|
|
10
|
-
* flow blocks.
|
|
9
|
+
* Micromark extension that tokenizes MDX-like components.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* **Flow (block)** — captures 1) PascalCase components and 2) lowercase HTML tags
|
|
12
|
+
* that carry `{…}` attribute expressions as single flow blocks (including
|
|
13
|
+
* self-closing `<Component />`). Prevents CommonMark from fragmenting them
|
|
14
|
+
* across multiple HTML / paragraph nodes.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* **Text (inline)** — registers only for lowercase tags with brace attrs
|
|
17
|
+
* (e.g. `Start <a href={url}>here</a> end`). Picks them up during inline
|
|
18
|
+
* parsing so they render inline inside their paragraph, then are rewritten
|
|
19
|
+
* to `mdxJsxTextElement` by the `components/inline-html` transformer.
|
|
20
|
+
* PascalCase is intentionally flow-only; ReadMe's custom components are
|
|
21
|
+
* authored as block-level elements.
|
|
18
22
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
23
|
+
* Excludes tags handled by dedicated tokenizers: Table, HTMLBlock, Glossary,
|
|
24
|
+
* Anchor.
|
|
25
|
+
*
|
|
26
|
+
* The resulting `html` mdast node is later restructured into an
|
|
27
|
+
* `mdxJsxFlowElement` (block) or `mdxJsxTextElement` (inline) by the
|
|
28
|
+
* corresponding component-block transformer.
|
|
22
29
|
*/
|
|
23
30
|
export declare function mdxComponent(): Extension;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
|
2
|
+
export interface ParseAttributesOptions {
|
|
3
|
+
/**
|
|
4
|
+
* When true, attribute expressions (`attr={expr}`) are kept as literal strings with
|
|
5
|
+
* their braces so downstream consumers don't evaluate them. This preserves safeMode
|
|
6
|
+
* semantics where all expression syntax is ignored.
|
|
7
|
+
*/
|
|
8
|
+
preserveExpressionsAsText?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Convert raw attribute string into mdxJsxAttribute entries using a single-pass
|
|
12
|
+
* character-walking tokenizer. Handles arbitrary brace nesting depth.
|
|
13
|
+
*
|
|
14
|
+
* Supports:
|
|
15
|
+
* - Boolean attributes: `empty` → value: null
|
|
16
|
+
* - Quoted attributes: `attr="value"` or `attr='value'` → value: string
|
|
17
|
+
* - Expression attributes: `attr={expr}` → value: MdxJsxAttributeValueExpression
|
|
18
|
+
* - Unquoted attributes: `attr=value` → value: string
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseAttributes: (raw: string, opts?: ParseAttributesOptions) => MdxJsxAttribute[];
|
|
21
|
+
/**
|
|
22
|
+
* Parse an HTML tag string into structured data.
|
|
23
|
+
* Uses a simple regex for the tag name, then a character walker to find the
|
|
24
|
+
* closing `>` so that brace expressions and quoted strings inside attributes
|
|
25
|
+
* are handled correctly at any nesting depth.
|
|
26
|
+
*/
|
|
27
|
+
export declare const parseTag: (value: string, opts?: ParseAttributesOptions) => {
|
|
28
|
+
tag: string;
|
|
29
|
+
attributes: MdxJsxAttribute[];
|
|
30
|
+
selfClosing: boolean;
|
|
31
|
+
contentAfterTag: string;
|
|
32
|
+
attrString: string;
|
|
33
|
+
};
|