@readme/markdown 14.13.2 → 14.14.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/dist/index.d.ts +1 -1
- package/dist/lib/constants.d.ts +4 -2
- package/dist/lib/htmlToMarkdown.d.ts +5 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/micromark/mdx-component/syntax.d.ts +4 -2
- package/dist/lib/micromark/mdxish-extensions.d.ts +140 -0
- package/dist/lib/utils/jsx-acorn-parser.d.ts +10 -0
- package/dist/main.js +27440 -27381
- package/dist/main.node.js +27415 -27356
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/collapse-foreign-content-blank-lines.d.ts +2 -1
- package/dist/processor/transform/mdxish/components/utils.d.ts +7 -0
- package/dist/processor/transform/mdxish/indentation.d.ts +4 -5
- package/dist/processor/utils.d.ts +2 -6
- package/dist/render-fixture.node.js +26274 -26216
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +15 -5
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, 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, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
|
|
10
10
|
export type { MdxishOpts, RenderMdxishOpts, RunOpts } from './lib';
|
|
11
11
|
export { default as Owlmoji } from './lib/owlmoji';
|
|
12
12
|
export { Components, utils };
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -43,8 +43,10 @@ export declare const INLINE_COMPONENT_TAGS: Set<string>;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const GENERIC_MDX_COMPONENT_EXCLUDED_TAGS: Set<string>;
|
|
45
45
|
/**
|
|
46
|
-
* Tags the micromark `mdxComponent` tokenizer must not claim,
|
|
47
|
-
*
|
|
46
|
+
* Tags the micromark `mdxComponent` tokenizer must not claim: inline components,
|
|
47
|
+
* plus `Table` (whose rows `jsxTable` has to keep together). `HTMLBlock` is absent
|
|
48
|
+
* on purpose — claiming it yields the same `html` node, and the transforms skip it
|
|
49
|
+
* by name via {@link GENERIC_MDX_COMPONENT_EXCLUDED_TAGS}.
|
|
48
50
|
*/
|
|
49
51
|
export declare const TOKENIZER_MDX_COMPONENT_EXCLUDED_TAGS: Set<string>;
|
|
50
52
|
/**
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { default as astProcessor, remarkPlugins } from './ast-processor';
|
|
|
4
4
|
export { default as compile } from './compile';
|
|
5
5
|
export { default as exports } from './exports';
|
|
6
6
|
export { default as hast } from './hast';
|
|
7
|
+
export { default as htmlToMarkdown } from './htmlToMarkdown';
|
|
7
8
|
export { default as mdast } from './mdast';
|
|
8
9
|
export { default as mdastV6 } from './mdastV6';
|
|
9
10
|
export { default as mdx } from './mdx';
|
|
@@ -21,8 +21,10 @@ declare module 'micromark-util-types' {
|
|
|
21
21
|
* transformer. All other PascalCase is flow-only; ReadMe's custom components
|
|
22
22
|
* are authored as block-level elements.
|
|
23
23
|
*
|
|
24
|
-
* Excludes
|
|
25
|
-
*
|
|
24
|
+
* Excludes Table, Glossary and Anchor (`TOKENIZER_MDX_COMPONENT_EXCLUDED_TAGS`).
|
|
25
|
+
* `HTMLBlock` is deliberately *not* excluded — this claims it into the same
|
|
26
|
+
* opaque `html` node `htmlBlockComponent` would, and the transforms skip it by
|
|
27
|
+
* name via `GENERIC_MDX_COMPONENT_EXCLUDED_TAGS`.
|
|
26
28
|
*
|
|
27
29
|
* The resulting `html` mdast node is later restructured into an
|
|
28
30
|
* `mdxJsxFlowElement` (block) or `mdxJsxTextElement` (inline) by the
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Extension as FromMarkdownExtension } from 'mdast-util-from-markdown';
|
|
2
|
+
import type { Extension } from 'micromark-util-types';
|
|
3
|
+
import { mdxExpressionFromMarkdown } from 'mdast-util-mdx-expression';
|
|
4
|
+
import { mdxjsEsmFromMarkdown } from 'mdast-util-mdxjs-esm';
|
|
5
|
+
import { emptyTaskListItemFromMarkdown } from '../mdast-util/empty-task-list-item';
|
|
6
|
+
import { gemojiFromMarkdown } from '../mdast-util/gemoji';
|
|
7
|
+
import { htmlBlockComponentFromMarkdown } from '../mdast-util/html-block-component';
|
|
8
|
+
import { jsxTableFromMarkdown } from '../mdast-util/jsx-table';
|
|
9
|
+
import { legacyVariableFromMarkdown } from '../mdast-util/legacy-variable';
|
|
10
|
+
import { magicBlockFromMarkdown } from '../mdast-util/magic-block';
|
|
11
|
+
import { mdxComponentFromMarkdown } from '../mdast-util/mdx-component';
|
|
12
|
+
import { gemoji } from './gemoji';
|
|
13
|
+
import { htmlBlockComponent } from './html-block-component';
|
|
14
|
+
import { jsxComment } from './jsx-comment';
|
|
15
|
+
import { jsxTable } from './jsx-table';
|
|
16
|
+
import { legacyVariable } from './legacy-variable';
|
|
17
|
+
import { looseHtmlEntity, looseHtmlEntityFromMarkdown } from './loose-html-entities';
|
|
18
|
+
import { magicBlock } from './magic-block';
|
|
19
|
+
import { mdxComponent } from './mdx-component';
|
|
20
|
+
import { mdxExpressionLenient } from './mdx-expression-lenient';
|
|
21
|
+
/**
|
|
22
|
+
* Constructs disabled for every MDXish parser.
|
|
23
|
+
* -`codeIndented`: To avoid formatting 4+ column indentation as code (default commonmark behavior)
|
|
24
|
+
* and match MDX behavior.
|
|
25
|
+
* Pass `extra` to disable more on top of the shared set, never in place of it.
|
|
26
|
+
*/
|
|
27
|
+
export declare const disableConstructs: (extra?: readonly string[]) => Extension;
|
|
28
|
+
/**
|
|
29
|
+
* Every MDXish extension, in canonical registration order — **lowest priority
|
|
30
|
+
* first** (`combineExtensions` prepends, so a later entry is tried first), each
|
|
31
|
+
* syntax extension paired with its `fromMarkdown` counterpart.
|
|
32
|
+
*
|
|
33
|
+
* Notes:
|
|
34
|
+
* - `<` is the only contended code, in both `flow` and `text`. Every contender
|
|
35
|
+
* currently emits the same opaque `html` node, so this order is a latent
|
|
36
|
+
* guarantee, not an active fix — it starts mattering if one emits a different token.
|
|
37
|
+
*/
|
|
38
|
+
declare const REGISTRY: {
|
|
39
|
+
jsxComment: {
|
|
40
|
+
syntax: typeof jsxComment;
|
|
41
|
+
expression: true;
|
|
42
|
+
};
|
|
43
|
+
jsxTable: {
|
|
44
|
+
syntax: typeof jsxTable;
|
|
45
|
+
fromMarkdown: typeof jsxTableFromMarkdown;
|
|
46
|
+
};
|
|
47
|
+
magicBlock: {
|
|
48
|
+
syntax: typeof magicBlock;
|
|
49
|
+
fromMarkdown: typeof magicBlockFromMarkdown;
|
|
50
|
+
};
|
|
51
|
+
mdxExpressionLenient: {
|
|
52
|
+
syntax: typeof mdxExpressionLenient;
|
|
53
|
+
fromMarkdown: typeof mdxExpressionFromMarkdown;
|
|
54
|
+
expression: true;
|
|
55
|
+
};
|
|
56
|
+
mdxExpression: {
|
|
57
|
+
syntax: () => Extension;
|
|
58
|
+
fromMarkdown: typeof mdxExpressionFromMarkdown;
|
|
59
|
+
expression: true;
|
|
60
|
+
};
|
|
61
|
+
mdxComponent: {
|
|
62
|
+
syntax: typeof mdxComponent;
|
|
63
|
+
fromMarkdown: typeof mdxComponentFromMarkdown;
|
|
64
|
+
};
|
|
65
|
+
gemoji: {
|
|
66
|
+
syntax: typeof gemoji;
|
|
67
|
+
fromMarkdown: typeof gemojiFromMarkdown;
|
|
68
|
+
};
|
|
69
|
+
legacyVariable: {
|
|
70
|
+
syntax: typeof legacyVariable;
|
|
71
|
+
fromMarkdown: typeof legacyVariableFromMarkdown;
|
|
72
|
+
};
|
|
73
|
+
looseHtmlEntity: {
|
|
74
|
+
syntax: typeof looseHtmlEntity;
|
|
75
|
+
fromMarkdown: typeof looseHtmlEntityFromMarkdown;
|
|
76
|
+
};
|
|
77
|
+
htmlBlockComponent: {
|
|
78
|
+
syntax: typeof htmlBlockComponent;
|
|
79
|
+
fromMarkdown: typeof htmlBlockComponentFromMarkdown;
|
|
80
|
+
};
|
|
81
|
+
mdxjsEsm: {
|
|
82
|
+
syntax: () => Extension;
|
|
83
|
+
fromMarkdown: typeof mdxjsEsmFromMarkdown;
|
|
84
|
+
expression: true;
|
|
85
|
+
};
|
|
86
|
+
emptyTaskListItem: {
|
|
87
|
+
fromMarkdown: typeof emptyTaskListItemFromMarkdown;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export type MdxishFeature = keyof typeof REGISTRY;
|
|
91
|
+
/**
|
|
92
|
+
* The feature set of every MDXish sub-parser, kept together so adding a
|
|
93
|
+
* tokenizer means deciding for each one rather than silently reaching none of
|
|
94
|
+
* them. A site opting out of a group should say so here, in the open.
|
|
95
|
+
*/
|
|
96
|
+
export declare const FEATURES: {
|
|
97
|
+
/** `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")[];
|
|
99
|
+
/**
|
|
100
|
+
* `components/utils.ts` — re-parses a component body, which should tokenize
|
|
101
|
+
* like the document around it: when the two drifted a `<Table>` in a
|
|
102
|
+
* `<Callout>` lost every row (CX-3705).
|
|
103
|
+
*/
|
|
104
|
+
componentBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
105
|
+
/**
|
|
106
|
+
* `lib/mdxishTags.ts` — collects component names, so nothing inline is needed.
|
|
107
|
+
* Omits `htmlBlockComponent` deliberately since it's not a custom component,
|
|
108
|
+
* and no components are meant to be nested inside it (it's just for raw HTML).
|
|
109
|
+
*/
|
|
110
|
+
tags: ("gemoji" | "mdxjsEsm" | "magicBlock" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
111
|
+
/** `tables/mdxish-tables.ts` — table cells */
|
|
112
|
+
tableCell: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
113
|
+
/** `magic-blocks` — legacy content, no components */
|
|
114
|
+
magicBlockBody: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
115
|
+
/** `magic-blocks` — api-header titles */
|
|
116
|
+
apiHeaderTitle: ("gemoji" | "mdxjsEsm" | "magicBlock" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
117
|
+
/**
|
|
118
|
+
* `lib/stripComments.ts` — parses only to strip comments, then re-stringifies,
|
|
119
|
+
* so it needs the tokenizers that keep a construct in one piece across the
|
|
120
|
+
* round trip.
|
|
121
|
+
* No inline syntax: nothing here rewrites prose, and magic blocks are already excluded.
|
|
122
|
+
*/
|
|
123
|
+
stripComments: ("gemoji" | "mdxjsEsm" | "htmlBlockComponent" | "jsxTable" | "legacyVariable" | "looseHtmlEntity" | "mdxComponent" | "jsxComment" | "mdxExpressionLenient" | "mdxExpression" | "emptyTaskListItem")[];
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Builds the extension lists for an MDXish parser. `features` is an unordered
|
|
127
|
+
* set — ordering is `REGISTRY`'s job, so a call site can't get it wrong — and
|
|
128
|
+
* the base construct config is always registered.
|
|
129
|
+
*
|
|
130
|
+
* Extensions outside the registry (`mdxjs()`, `gfmStrikethrough()`) stay at their
|
|
131
|
+
* call site; spread them onto the result, minding the `flow` + `<` order.
|
|
132
|
+
*/
|
|
133
|
+
export declare function mdxishExtensions(features: readonly MdxishFeature[], { disable, safeMode }?: {
|
|
134
|
+
disable?: readonly string[];
|
|
135
|
+
safeMode?: boolean;
|
|
136
|
+
}): {
|
|
137
|
+
fromMarkdownExtensions: FromMarkdownExtension[];
|
|
138
|
+
micromarkExtensions: Extension[];
|
|
139
|
+
};
|
|
140
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Parser } from 'acorn';
|
|
2
|
+
/**
|
|
3
|
+
* Single instance of acorn parser extended with `acorn-jsx`
|
|
4
|
+
* to parse expressions containing JSX.
|
|
5
|
+
*
|
|
6
|
+
* Lives in its own dependency-free module because the micromark extension
|
|
7
|
+
* registry needs it during module initialisation, and `processor/utils` sits in
|
|
8
|
+
* an import cycle with the parsers that consume the registry.
|
|
9
|
+
*/
|
|
10
|
+
export declare const jsxAcornParser: typeof Parser;
|