@readme/markdown 15.9.3 → 15.10.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/index.d.ts +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/mdast-util/heading-id/index.d.ts +3 -0
- package/dist/lib/mdast-util/mdx-expression/index.d.ts +3 -0
- package/dist/lib/mdxish.d.ts +2 -0
- package/dist/lib/mdxishHeadingIds.d.ts +4 -0
- package/dist/lib/micromark/heading-id/index.d.ts +1 -0
- package/dist/lib/micromark/heading-id/syntax.d.ts +10 -0
- package/dist/lib/micromark/mdxish-extensions.d.ts +16 -10
- package/dist/lib/utils/mdxish/mdxish-variables.d.ts +3 -2
- package/dist/main.js +501 -208
- package/dist/main.node.js +501 -208
- package/dist/main.node.js.map +1 -1
- package/dist/processor/compile/heading.d.ts +5 -0
- package/dist/processor/transform/mdxish/heading-ids.d.ts +14 -0
- package/dist/processor/transform/mdxish/heading-slugs.d.ts +2 -1
- package/dist/processor/utils.d.ts +9 -1
- package/dist/render-fixture.node.js +508 -208
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const utils: {
|
|
|
6
6
|
getHref: typeof getHref;
|
|
7
7
|
calloutIcons: {};
|
|
8
8
|
};
|
|
9
|
-
export { compile, exports, FLOW_TYPES, hast, htmlToMarkdown, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
|
|
9
|
+
export { compile, exports, FLOW_TYPES, hast, htmlToMarkdown, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishHeadingIds, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
|
|
10
10
|
export type { ListMarker, ListWithMarker, MdxishOpts, RenderMdxishOpts, RunOpts } from './lib';
|
|
11
11
|
export { default as Owlmoji } from './lib/owlmoji';
|
|
12
12
|
export { Components, utils };
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as mdastV6 } from './mdastV6';
|
|
|
10
10
|
export { default as mdx } from './mdx';
|
|
11
11
|
export { default as mix } from './mix';
|
|
12
12
|
export { default as mdxish, mdxishAstProcessor, mdxishMdastToMd } from './mdxish';
|
|
13
|
+
export { mdxishHeadingIds } from './mdxishHeadingIds';
|
|
13
14
|
export type { ListMarker, ListWithMarker } from '../processor/compile/list';
|
|
14
15
|
export type { MdxishOpts } from './mdxish';
|
|
15
16
|
export { default as extractToc } from './extractToc';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown';
|
|
2
|
+
/** Upstream `mdxExpressionFromMarkdown`, overriding only the text-expression exit to keep `{...}` source in image alt. */
|
|
3
|
+
export declare function mdxishExpressionFromMarkdown(): FromMarkdownExtension;
|
package/dist/lib/mdxish.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare function mdxishAstProcessor(mdContent: string, opts?: MdxishOpts)
|
|
|
46
46
|
* Serializes an Mdast back into a markdown string.
|
|
47
47
|
*/
|
|
48
48
|
export declare function mdxishMdastToMd(mdast: MdastRoot): string;
|
|
49
|
+
/** The steps `mdxish()` runs after parsing; run it on the parse's VFile, since steps read `file.data`. */
|
|
50
|
+
export declare function mdxishRenderProcessor(opts?: MdxishOpts): import("unified").Processor<undefined, MdastRoot, Root, undefined, undefined>;
|
|
49
51
|
/**
|
|
50
52
|
* Processes markdown content with MDX syntax support and returns a HAST.
|
|
51
53
|
* Detects and renders custom component tags from the components hash.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MdxishOpts } from './mdxish';
|
|
2
|
+
import type { Heading, Root as MdastRoot } from 'mdast';
|
|
3
|
+
/** Each heading's rendered anchor id, worked out without running code; `null` when code could change them. */
|
|
4
|
+
export declare function mdxishHeadingIds(tree: MdastRoot, opts?: Omit<MdxishOpts, 'safeMode'>): Map<Heading, string> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { headingId } from './syntax';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Extension } from 'micromark-util-types';
|
|
2
|
+
declare module 'micromark-util-types' {
|
|
3
|
+
interface TokenTypeMap {
|
|
4
|
+
headingId: 'headingId';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/** One character a `{#id}` heading id may use: the ones github-slugger keeps, plus `.` and `:`. */
|
|
8
|
+
export declare const HEADING_ID_CHAR = "[\\p{L}\\p{M}\\p{N}_.:-]";
|
|
9
|
+
/** The ATX heading construct, with a line-final ` {#id}` split off as a `headingId` token. */
|
|
10
|
+
export declare function headingId(): Extension;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown';
|
|
2
2
|
import type { Extension } from 'micromark-util-types';
|
|
3
|
-
import { mdxExpressionFromMarkdown } from 'mdast-util-mdx-expression';
|
|
4
3
|
import { mdxjsEsmFromMarkdown } from 'mdast-util-mdxjs-esm';
|
|
5
4
|
import { emptyTaskListItemFromMarkdown } from '../mdast-util/empty-task-list-item';
|
|
6
5
|
import { gemojiFromMarkdown } from '../mdast-util/gemoji';
|
|
6
|
+
import { headingIdFromMarkdown } from '../mdast-util/heading-id';
|
|
7
7
|
import { htmlBlockComponentFromMarkdown } from '../mdast-util/html-block-component';
|
|
8
8
|
import { jsxTableFromMarkdown } from '../mdast-util/jsx-table';
|
|
9
9
|
import { legacyVariableFromMarkdown } from '../mdast-util/legacy-variable';
|
|
10
10
|
import { magicBlockFromMarkdown } from '../mdast-util/magic-block';
|
|
11
11
|
import { mdxComponentFromMarkdown } from '../mdast-util/mdx-component';
|
|
12
|
+
import { mdxishExpressionFromMarkdown } from '../mdast-util/mdx-expression';
|
|
12
13
|
import { gemoji } from './gemoji';
|
|
14
|
+
import { headingId } from './heading-id';
|
|
13
15
|
import { htmlBlockComponent } from './html-block-component';
|
|
14
16
|
import { jsxComment } from './jsx-comment';
|
|
15
17
|
import { jsxTable } from './jsx-table';
|
|
@@ -50,12 +52,12 @@ declare const REGISTRY: {
|
|
|
50
52
|
};
|
|
51
53
|
mdxExpressionLenient: {
|
|
52
54
|
syntax: typeof mdxExpressionLenient;
|
|
53
|
-
fromMarkdown: typeof
|
|
55
|
+
fromMarkdown: typeof mdxishExpressionFromMarkdown;
|
|
54
56
|
expression: true;
|
|
55
57
|
};
|
|
56
58
|
mdxExpression: {
|
|
57
59
|
syntax: () => Extension;
|
|
58
|
-
fromMarkdown: typeof
|
|
60
|
+
fromMarkdown: typeof mdxishExpressionFromMarkdown;
|
|
59
61
|
expression: true;
|
|
60
62
|
};
|
|
61
63
|
mdxComponent: {
|
|
@@ -70,6 +72,10 @@ declare const REGISTRY: {
|
|
|
70
72
|
syntax: typeof legacyVariable;
|
|
71
73
|
fromMarkdown: typeof legacyVariableFromMarkdown;
|
|
72
74
|
};
|
|
75
|
+
headingId: {
|
|
76
|
+
syntax: typeof headingId;
|
|
77
|
+
fromMarkdown: typeof headingIdFromMarkdown;
|
|
78
|
+
};
|
|
73
79
|
looseHtmlEntity: {
|
|
74
80
|
syntax: typeof looseHtmlEntity;
|
|
75
81
|
fromMarkdown: typeof looseHtmlEntityFromMarkdown;
|
|
@@ -95,32 +101,32 @@ export type MdxishFeature = keyof typeof REGISTRY;
|
|
|
95
101
|
*/
|
|
96
102
|
export declare const FEATURES: {
|
|
97
103
|
/** `lib/mdxish.ts` — the document parser; the only site taking every group */
|
|
98
|
-
document: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
104
|
+
document: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
99
105
|
/**
|
|
100
106
|
* `components/utils.ts` — re-parses a component body, which should tokenize
|
|
101
107
|
* like the document around it: when the two drifted a `<Table>` in a
|
|
102
108
|
* `<Callout>` lost every row (CX-3705).
|
|
103
109
|
*/
|
|
104
|
-
componentBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
110
|
+
componentBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
105
111
|
/**
|
|
106
112
|
* `lib/mdxishTags.ts` — collects component names, so nothing inline is needed.
|
|
107
113
|
* Omits `htmlBlockComponent` deliberately since it's not a custom component,
|
|
108
114
|
* and no components are meant to be nested inside it (it's just for raw HTML).
|
|
109
115
|
*/
|
|
110
|
-
tags: ("gemoji" | "mdxjsEsm" | "magicBlock" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
116
|
+
tags: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
111
117
|
/** `tables/mdxish-tables.ts` — table cells */
|
|
112
|
-
tableCell: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
118
|
+
tableCell: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
113
119
|
/** `magic-blocks` — legacy content, no components */
|
|
114
|
-
magicBlockBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
120
|
+
magicBlockBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
115
121
|
/** `magic-blocks` — api-header titles */
|
|
116
|
-
apiHeaderTitle: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
122
|
+
apiHeaderTitle: ("gemoji" | "mdxjsEsm" | "magicBlock" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
117
123
|
/**
|
|
118
124
|
* `lib/stripComments.ts` — parses only to strip comments, then re-stringifies,
|
|
119
125
|
* so it needs the tokenizers that keep a construct in one piece across the
|
|
120
126
|
* round trip.
|
|
121
127
|
* No inline syntax: nothing here rewrites prose, and magic blocks are already excluded.
|
|
122
128
|
*/
|
|
123
|
-
stripComments: ("gemoji" | "mdxjsEsm" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
129
|
+
stripComments: ("gemoji" | "mdxjsEsm" | "headingId" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
124
130
|
};
|
|
125
131
|
/**
|
|
126
132
|
* Builds the extension lists for an MDXish parser. `features` is an unordered
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* so both engines agree. Body text differs on empty values: `Variable` falls back to the default.
|
|
4
4
|
*
|
|
5
5
|
* Legacy `<<...>>` is valid inside a quoted attribute but deliberately left literal — attributes are
|
|
6
|
-
* an MDX surface, and `{user.*}` is the syntax authors use there.
|
|
6
|
+
* an MDX surface, and `{user.*}` is the syntax authors use there. Image alt is the exception, resolved
|
|
7
|
+
* in the same pass so a substituted value is never rescanned (RM-10865).
|
|
7
8
|
*/
|
|
8
|
-
export declare function resolveAttributeVariables(value: string, user: Record<string, unknown
|
|
9
|
+
export declare function resolveAttributeVariables(value: string, user: Record<string, unknown>, isImageAlt?: boolean): string;
|
|
9
10
|
/** Whether an attribute expression's source is a bare `user.*` reference, left for render-time substitution. */
|
|
10
11
|
export declare const isBareVariableReference: (source: string) => boolean;
|