@readme/markdown 8.2.0 → 8.3.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/components/Accordion/index.tsx +5 -2
- package/components/Anchor.jsx +1 -1
- package/components/Callout/index.tsx +5 -4
- package/components/Cards/index.tsx +17 -5
- package/components/Code/index.tsx +11 -2
- package/components/CodeTabs/index.tsx +5 -1
- package/components/Columns/index.tsx +7 -6
- package/components/Embed/index.tsx +10 -7
- package/components/Glossary/index.tsx +8 -4
- package/components/HTMLBlock/index.tsx +10 -2
- package/components/Heading/index.tsx +6 -2
- package/components/Image/index.tsx +15 -13
- package/components/Table/index.tsx +2 -2
- package/components/Tabs/index.tsx +21 -14
- package/components/TailwindRoot/index.tsx +3 -1
- package/dist/components/Accordion/index.d.ts +7 -6
- package/dist/components/Callout/index.d.ts +2 -2
- package/dist/components/Cards/index.d.ts +13 -11
- package/dist/components/CodeTabs/index.d.ts +5 -1
- package/dist/components/Columns/index.d.ts +6 -7
- package/dist/components/Embed/index.d.ts +6 -6
- package/dist/components/Glossary/index.d.ts +4 -3
- package/dist/components/HTMLBlock/index.d.ts +5 -4
- package/dist/components/Heading/index.d.ts +1 -1
- package/dist/components/Image/index.d.ts +2 -2
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Tabs/index.d.ts +5 -6
- package/dist/components/TailwindRoot/index.d.ts +5 -4
- package/dist/contexts/GlossaryTerms.d.ts +4 -4
- package/dist/contexts/index.d.ts +2 -2
- package/dist/errors/mdx-syntax-error.d.ts +1 -1
- package/dist/example/RenderError.d.ts +5 -4
- package/dist/lib/ast-processor.d.ts +5 -5
- package/dist/lib/compile.d.ts +1 -3
- package/dist/lib/hast.d.ts +1 -1
- package/dist/lib/mdast.d.ts +3 -1
- package/dist/lib/mdastV6.d.ts +4 -1
- package/dist/lib/mdx.d.ts +3 -1
- package/dist/lib/plain.d.ts +1 -1
- package/dist/lib/run.d.ts +6 -12
- package/dist/main.js +24007 -23860
- package/dist/main.node.js +22046 -21899
- package/dist/main.node.js.map +1 -1
- package/dist/processor/compile/callout.d.ts +1 -1
- package/dist/processor/compile/code-tabs.d.ts +1 -1
- package/dist/processor/compile/compatibility.d.ts +20 -31
- package/dist/processor/compile/embed.d.ts +1 -1
- package/dist/processor/compile/gemoji.d.ts +1 -1
- package/dist/processor/compile/html-block.d.ts +1 -1
- package/dist/processor/compile/variable.d.ts +1 -1
- package/dist/processor/plugin/toc.d.ts +4 -4
- package/dist/processor/transform/callouts.d.ts +2 -1
- package/dist/processor/transform/code-tabs.d.ts +1 -1
- package/dist/processor/transform/compatability.d.ts +1 -1
- package/dist/processor/transform/div.d.ts +1 -1
- package/dist/processor/transform/embeds.d.ts +1 -1
- package/dist/processor/transform/gemoji+.d.ts +1 -1
- package/dist/processor/transform/images.d.ts +1 -1
- package/dist/processor/transform/index.d.ts +4 -4
- package/dist/processor/transform/inject-components.d.ts +2 -2
- package/dist/processor/transform/mdx-to-hast.d.ts +1 -1
- package/dist/processor/transform/mermaid.d.ts +1 -1
- package/dist/processor/transform/readme-components.d.ts +1 -1
- package/dist/processor/transform/readme-to-mdx.d.ts +1 -1
- package/dist/processor/transform/tables-to-jsx.d.ts +1 -1
- package/dist/processor/transform/tailwind.d.ts +1 -1
- package/dist/processor/transform/variables.d.ts +1 -1
- package/dist/processor/utils.d.ts +8 -8
- package/dist/utils/user.d.ts +2 -2
- package/package.json +4 -1
|
@@ -1,53 +1,42 @@
|
|
|
1
|
-
import { Html
|
|
1
|
+
import type { Html } from 'mdast';
|
|
2
|
+
import type { Figure } from 'types';
|
|
2
3
|
import { NodeTypes } from '../../enums';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
interface EditorGlossary {
|
|
5
|
+
children: [{
|
|
6
|
+
type: 'text';
|
|
7
|
+
value: string;
|
|
8
|
+
}];
|
|
5
9
|
data: {
|
|
10
|
+
hName: 'Glossary';
|
|
6
11
|
hProperties: {
|
|
7
12
|
term: string;
|
|
8
13
|
};
|
|
9
14
|
};
|
|
10
|
-
} | {
|
|
11
15
|
type: NodeTypes.glossary;
|
|
16
|
+
}
|
|
17
|
+
interface CompatEmbed {
|
|
12
18
|
data: {
|
|
13
|
-
|
|
19
|
+
hProperties: Record<string, string>;
|
|
14
20
|
};
|
|
15
|
-
|
|
16
|
-
type: 'text';
|
|
17
|
-
value: string;
|
|
18
|
-
}];
|
|
19
|
-
} | {
|
|
20
|
-
type: NodeTypes.reusableContent;
|
|
21
|
-
tag: string;
|
|
22
|
-
} | {
|
|
21
|
+
html: string;
|
|
23
22
|
type: 'embed';
|
|
23
|
+
}
|
|
24
|
+
type CompatNodes = CompatEmbed | EditorGlossary | Figure | Html | {
|
|
24
25
|
data: {
|
|
25
26
|
hProperties: {
|
|
26
|
-
|
|
27
|
+
className: string[];
|
|
27
28
|
};
|
|
28
29
|
};
|
|
30
|
+
type: 'i';
|
|
31
|
+
} | {
|
|
32
|
+
tag: string;
|
|
33
|
+
type: NodeTypes.reusableContent;
|
|
29
34
|
} | {
|
|
30
35
|
type: 'escape';
|
|
31
36
|
value: string;
|
|
32
|
-
} | {
|
|
33
|
-
type: 'figure';
|
|
34
|
-
children: [Image, {
|
|
35
|
-
type: 'figcaption';
|
|
36
|
-
children: [{
|
|
37
|
-
type: 'text';
|
|
38
|
-
value: string;
|
|
39
|
-
}];
|
|
40
|
-
}];
|
|
41
|
-
} | {
|
|
42
|
-
type: 'i';
|
|
43
|
-
data: {
|
|
44
|
-
hProperties: {
|
|
45
|
-
className: string[];
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
37
|
} | {
|
|
49
38
|
type: 'yaml';
|
|
50
39
|
value: string;
|
|
51
|
-
}
|
|
40
|
+
};
|
|
52
41
|
declare const compatibility: (node: CompatNodes) => string;
|
|
53
42
|
export default compatibility;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Root } from 'hast';
|
|
3
|
-
import {
|
|
1
|
+
import type { CustomComponents, IndexableElements } from '../../types';
|
|
2
|
+
import type { Root } from 'hast';
|
|
3
|
+
import type { Transformer } from 'unified';
|
|
4
4
|
interface Options {
|
|
5
|
-
components?:
|
|
5
|
+
components?: CustomComponents;
|
|
6
6
|
}
|
|
7
7
|
export declare const rehypeToc: ({ components }: Options) => Transformer<Root, Root>;
|
|
8
8
|
export declare const tocToMdx: (toc: IndexableElements[], components: CustomComponents) => string;
|
|
@@ -6,11 +6,11 @@ import mermaidTransformer from './mermaid';
|
|
|
6
6
|
import readmeComponentsTransformer from './readme-components';
|
|
7
7
|
import readmeToMdx from './readme-to-mdx';
|
|
8
8
|
import tablesToJsx from './tables-to-jsx';
|
|
9
|
-
import variablesTransformer from './variables';
|
|
10
9
|
import tailwindTransformer from './tailwind';
|
|
10
|
+
import variablesTransformer from './variables';
|
|
11
11
|
export { compatabilityTransfomer, divTransformer, injectComponents, mdxToHast, mermaidTransformer, readmeComponentsTransformer, readmeToMdx, tablesToJsx, tailwindTransformer, variablesTransformer, };
|
|
12
12
|
export declare const defaultTransforms: {
|
|
13
|
-
calloutTransformer: () => (tree:
|
|
13
|
+
calloutTransformer: () => (tree: import("mdast").Root) => void;
|
|
14
14
|
codeTabsTransformer: ({ copyButtons }?: {
|
|
15
15
|
copyButtons?: boolean;
|
|
16
16
|
}) => (tree: import("mdast").Node) => import("mdast").Node;
|
|
@@ -18,7 +18,7 @@ export declare const defaultTransforms: {
|
|
|
18
18
|
imageTransformer: () => (tree: import("mdast").Node) => import("mdast").Node;
|
|
19
19
|
gemojiTransformer: () => (tree: import("mdast").Root) => import("mdast").Root;
|
|
20
20
|
};
|
|
21
|
-
declare const _default: ((() => (tree:
|
|
21
|
+
declare const _default: ((() => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
|
|
22
22
|
copyButtons?: boolean;
|
|
23
|
-
}) => (tree: import("mdast").Node) => import("mdast").Node) | (() => (tree: import("mdast").Node) => void) | (() => (tree: import("mdast").
|
|
23
|
+
}) => (tree: import("mdast").Node) => import("mdast").Node) | (() => (tree: import("mdast").Node) => void) | (() => (tree: import("mdast").Root) => import("mdast").Root) | (() => (tree: import("mdast").Node) => import("mdast").Node))[];
|
|
24
24
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MdastComponents } from '../../types';
|
|
2
|
-
import { Transform } from 'mdast-util-from-markdown';
|
|
1
|
+
import type { MdastComponents } from '../../types';
|
|
2
|
+
import type { Transform } from 'mdast-util-from-markdown';
|
|
3
3
|
interface Options {
|
|
4
4
|
components?: MdastComponents;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Node, Root as MdastRoot, Root } from 'mdast';
|
|
2
1
|
import type { Root as HastRoot } from 'hast';
|
|
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
5
|
/**
|
|
@@ -18,7 +18,7 @@ export declare const formatHProps: <T>(node: Node) => string;
|
|
|
18
18
|
* @param {Object} props
|
|
19
19
|
* @returns {string}
|
|
20
20
|
*/
|
|
21
|
-
export declare const formatProps: (props:
|
|
21
|
+
export declare const formatProps: <T>(props: T) => string;
|
|
22
22
|
/**
|
|
23
23
|
* Returns the hProperties of a node.
|
|
24
24
|
*
|
|
@@ -34,7 +34,7 @@ export declare const getHProps: <T>(node: Node) => T;
|
|
|
34
34
|
* @param {Node} node
|
|
35
35
|
* @returns {Array} array of hProperty keys
|
|
36
36
|
*/
|
|
37
|
-
export declare const getHPropKeys: <T>(node: Node) =>
|
|
37
|
+
export declare const getHPropKeys: <T>(node: Node) => string[];
|
|
38
38
|
/**
|
|
39
39
|
* Gets the attributes of an MDX element and returns them as an object of hProperties.
|
|
40
40
|
*
|
|
@@ -42,7 +42,7 @@ export declare const getHPropKeys: <T>(node: Node) => any;
|
|
|
42
42
|
* @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
|
|
43
43
|
* @returns {T} object of hProperties
|
|
44
44
|
*/
|
|
45
|
-
export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) =>
|
|
45
|
+
export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => T;
|
|
46
46
|
/**
|
|
47
47
|
* Gets the children of an MDX element and returns them as an array of Text nodes.
|
|
48
48
|
* Currently only being used by the HTML Block component, which only expects a single text node.
|
|
@@ -51,7 +51,7 @@ export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) =
|
|
|
51
51
|
* @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
|
|
52
52
|
* @returns {Array} array of child text nodes
|
|
53
53
|
*/
|
|
54
|
-
export declare const getChildren: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) =>
|
|
54
|
+
export declare const getChildren: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => T;
|
|
55
55
|
/**
|
|
56
56
|
* Tests if a node is an MDX element.
|
|
57
57
|
* TODO: Make this more extensible to all types of nodes. isElement(node, 'type' or ['type1', 'type2']), say
|
|
@@ -83,8 +83,8 @@ export declare const formatHTML: (html: string) => string;
|
|
|
83
83
|
* @param {number} [indent=2]
|
|
84
84
|
* @returns {string} re-formatted HTML
|
|
85
85
|
*/
|
|
86
|
-
export declare const reformatHTML: (html: string
|
|
87
|
-
export declare const toAttributes: (object: Record<string,
|
|
86
|
+
export declare const reformatHTML: (html: string) => string;
|
|
87
|
+
export declare const toAttributes: (object: Record<string, unknown>, keys?: string[]) => MdxJsxAttribute[];
|
|
88
88
|
/**
|
|
89
89
|
* Checks if a named export exists in the MDX tree. Accepts either an mdast or
|
|
90
90
|
* a hast tree.
|
|
@@ -97,5 +97,5 @@ export declare const toAttributes: (object: Record<string, any>, keys?: string[]
|
|
|
97
97
|
* ```
|
|
98
98
|
*
|
|
99
99
|
*/
|
|
100
|
-
export declare const hasNamedExport: (tree:
|
|
100
|
+
export declare const hasNamedExport: (tree: HastRoot | MdastRoot, name: string) => boolean;
|
|
101
101
|
export declare const getExports: (tree: Root) => string[];
|
package/dist/utils/user.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
interface Default {
|
|
2
|
-
name: string;
|
|
3
2
|
default: string;
|
|
3
|
+
name: string;
|
|
4
4
|
}
|
|
5
5
|
export interface Variables {
|
|
6
|
-
user: Record<string, string>;
|
|
7
6
|
defaults: Default[];
|
|
7
|
+
user: Record<string, string>;
|
|
8
8
|
}
|
|
9
9
|
declare const User: (variables?: Variables) => Record<string, string>;
|
|
10
10
|
export default User;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.3.0",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"browser": "dist/main.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"lodash.kebabcase": "^4.1.1",
|
|
42
42
|
"mdast-util-find-and-replace": "^3.0.1",
|
|
43
43
|
"mdast-util-phrasing": "^4.1.0",
|
|
44
|
+
"mdast-util-to-markdown": "^2.1.2",
|
|
44
45
|
"path-browserify": "^1.0.1",
|
|
45
46
|
"postcss": "^8.5.1",
|
|
46
47
|
"postcss-prefix-selector": "^2.1.0",
|
|
@@ -53,6 +54,8 @@
|
|
|
53
54
|
"remark-gfm": "^4.0.0",
|
|
54
55
|
"remark-mdx": "^3.0.0",
|
|
55
56
|
"remark-parse": "^11.0.0",
|
|
57
|
+
"remark-rehype": "^11.1.1",
|
|
58
|
+
"remark-stringify": "^11.0.0",
|
|
56
59
|
"tailwindcss": "^4.0.3",
|
|
57
60
|
"unified": "^11.0.4",
|
|
58
61
|
"unist-util-flatmap": "^1.0.0",
|