@readme/markdown 6.87.1 → 6.89.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/README.md +81 -23
- package/components/Anchor.jsx +15 -26
- package/components/Callout/index.tsx +41 -0
- package/components/Callout/style.scss +11 -39
- package/components/CardsGrid/index.tsx +18 -0
- package/components/CardsGrid/style.scss +12 -0
- package/components/Code/index.tsx +75 -0
- package/components/Code/style.scss +54 -47
- package/components/CodeTabs/index.tsx +38 -0
- package/components/CodeTabs/style.scss +22 -30
- package/components/Embed/index.tsx +98 -0
- package/components/Embed/style.scss +59 -69
- package/components/Glossary/index.tsx +37 -0
- package/components/{GlossaryItem → Glossary}/style.scss +16 -18
- package/components/HTMLBlock/index.tsx +38 -0
- package/components/Heading/index.tsx +31 -0
- package/components/Heading/style.scss +9 -15
- package/components/Image/index.tsx +113 -0
- package/components/Image/style.scss +62 -64
- package/components/Table/index.tsx +20 -0
- package/components/Table/style.scss +17 -23
- package/components/TableOfContents/{index.jsx → index.tsx} +3 -8
- package/components/{index.js → index.ts} +2 -2
- package/dist/components/Callout/index.d.ts +9 -0
- package/dist/components/CardsGrid/index.d.ts +7 -0
- package/dist/components/Code/index.d.ts +11 -0
- package/dist/components/CodeTabs/index.d.ts +3 -0
- package/dist/components/Embed/index.d.ts +15 -0
- package/dist/components/Glossary/index.d.ts +10 -0
- package/dist/components/HTMLBlock/index.d.ts +7 -0
- package/dist/components/Heading/index.d.ts +8 -0
- package/dist/components/Image/index.d.ts +16 -0
- package/dist/components/Table/index.d.ts +7 -0
- package/dist/components/TableOfContents/index.d.ts +3 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/contexts/GlossaryTerms.d.ts +7 -0
- package/dist/contexts/index.d.ts +5 -0
- package/dist/enums.d.ts +14 -0
- package/dist/errors/mdx-syntax-error.d.ts +5 -0
- package/dist/example/App.d.ts +4 -0
- package/dist/example/Doc.d.ts +3 -0
- package/dist/example/Form.d.ts +3 -0
- package/dist/example/Header.d.ts +3 -0
- package/dist/example/RenderError.d.ts +23 -0
- package/dist/example/Root.d.ts +3 -0
- package/dist/example/docs.d.ts +2 -0
- package/dist/example/index.d.ts +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/lib/ast-processor.d.ts +12 -0
- package/dist/lib/compile.d.ts +8 -0
- package/dist/lib/hast.d.ts +3 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/mdast.d.ts +2 -0
- package/dist/lib/mdx.d.ts +4 -0
- package/dist/lib/owlmoji.d.ts +4 -0
- package/dist/lib/plain.d.ts +6 -0
- package/dist/lib/run.d.ts +24 -0
- package/dist/main.css +2 -17
- package/dist/main.js +70676 -29848
- package/dist/main.node.js +90238 -50277
- package/dist/processor/compile/callout.d.ts +3 -0
- package/dist/processor/compile/code-tabs.d.ts +3 -0
- package/dist/processor/compile/compatibility.d.ts +53 -0
- package/dist/processor/compile/embed.d.ts +3 -0
- package/dist/processor/compile/gemoji.d.ts +3 -0
- package/dist/processor/compile/html-block.d.ts +3 -0
- package/dist/processor/compile/image.d.ts +3 -0
- package/dist/processor/compile/index.d.ts +2 -0
- package/dist/processor/compile/table.d.ts +0 -0
- package/dist/processor/compile/variable.d.ts +3 -0
- package/dist/processor/plugin/toc.d.ts +9 -0
- package/dist/processor/transform/callouts.d.ts +2 -0
- package/dist/processor/transform/code-tabs.d.ts +3 -0
- package/dist/processor/transform/div.d.ts +3 -0
- package/dist/processor/transform/embeds.d.ts +3 -0
- package/dist/processor/transform/gemoji+.d.ts +3 -0
- package/dist/processor/transform/images.d.ts +3 -0
- package/dist/processor/transform/index.d.ts +9 -0
- package/dist/processor/transform/inject-components.d.ts +7 -0
- package/dist/processor/transform/readme-components.d.ts +7 -0
- package/dist/processor/transform/readme-to-mdx.d.ts +3 -0
- package/dist/processor/transform/tables-to-jsx.d.ts +3 -0
- package/dist/processor/transform/variables.d.ts +5 -0
- package/dist/processor/utils.d.ts +77 -0
- package/package.json +93 -99
- package/styles/components.scss +1 -1
- package/components/Callout/index.jsx +0 -42
- package/components/Code/index.jsx +0 -103
- package/components/CodeTabs/index.jsx +0 -60
- package/components/Embed/index.jsx +0 -88
- package/components/GlossaryItem/index.jsx +0 -44
- package/components/HTMLBlock/index.jsx +0 -68
- package/components/Heading/index.jsx +0 -56
- package/components/Image/index.jsx +0 -107
- package/components/Style.jsx +0 -30
- package/components/Table/index.jsx +0 -19
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Html, Image } from 'mdast';
|
|
2
|
+
import { NodeTypes } from '../../enums';
|
|
3
|
+
type CompatNodes = {
|
|
4
|
+
type: NodeTypes.glossary;
|
|
5
|
+
data: {
|
|
6
|
+
hProperties: {
|
|
7
|
+
term: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
type: NodeTypes.glossary;
|
|
12
|
+
data: {
|
|
13
|
+
hName: 'Glossary';
|
|
14
|
+
};
|
|
15
|
+
children: [{
|
|
16
|
+
type: 'text';
|
|
17
|
+
value: string;
|
|
18
|
+
}];
|
|
19
|
+
} | {
|
|
20
|
+
type: NodeTypes.reusableContent;
|
|
21
|
+
tag: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'embed';
|
|
24
|
+
data: {
|
|
25
|
+
hProperties: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: 'escape';
|
|
31
|
+
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
|
+
} | {
|
|
49
|
+
type: 'yaml';
|
|
50
|
+
value: string;
|
|
51
|
+
} | Html;
|
|
52
|
+
declare const compatibility: (node: CompatNodes) => string;
|
|
53
|
+
export default compatibility;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Transformer } from 'unified';
|
|
2
|
+
import { Root } from 'hast';
|
|
3
|
+
import { CustomComponents, IndexableElements } from '../../types';
|
|
4
|
+
interface Options {
|
|
5
|
+
components?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export declare const rehypeToc: ({ components }: Options) => Transformer<Root, Root>;
|
|
8
|
+
export declare const tocToMdx: (toc: IndexableElements[], components: CustomComponents) => string;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import divTransformer from './div';
|
|
2
|
+
import injectComponents from './inject-components';
|
|
3
|
+
import readmeComponentsTransformer from './readme-components';
|
|
4
|
+
import readmeToMdx from './readme-to-mdx';
|
|
5
|
+
import variablesTransformer from './variables';
|
|
6
|
+
import tablesToJsx from './tables-to-jsx';
|
|
7
|
+
export { divTransformer, readmeComponentsTransformer, readmeToMdx, injectComponents, variablesTransformer, tablesToJsx, };
|
|
8
|
+
declare const _default: (() => (tree: any) => void)[];
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Node } from 'mdast';
|
|
2
|
+
import { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
|
|
3
|
+
/**
|
|
4
|
+
* Formats the hProperties of a node as a string, so they can be compiled back into JSX/MDX.
|
|
5
|
+
* This currently sets all the values to a string since we process/compile the MDX on the fly
|
|
6
|
+
* through the editor, and it'll throw errors over malformed JSX. TODO: fix this.
|
|
7
|
+
*
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {Node} node
|
|
10
|
+
* @returns {string} formatted hProperties as JSX attributes
|
|
11
|
+
*/
|
|
12
|
+
export declare const formatHProps: <T>(node: Node) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Formats an object of props as a string.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} props
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
export declare const formatProps: (props: Object) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the hProperties of a node.
|
|
22
|
+
*
|
|
23
|
+
* @template T
|
|
24
|
+
* @param {Node} node
|
|
25
|
+
* @returns {T} hProperties
|
|
26
|
+
*/
|
|
27
|
+
export declare const getHProps: <T>(node: Node) => T;
|
|
28
|
+
/**
|
|
29
|
+
* Returns array of hProperty keys.
|
|
30
|
+
*
|
|
31
|
+
* @template T
|
|
32
|
+
* @param {Node} node
|
|
33
|
+
* @returns {Array} array of hProperty keys
|
|
34
|
+
*/
|
|
35
|
+
export declare const getHPropKeys: <T>(node: Node) => any;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the attributes of an MDX element and returns them as an object of hProperties.
|
|
38
|
+
*
|
|
39
|
+
* @template T
|
|
40
|
+
* @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
|
|
41
|
+
* @returns {T} object of hProperties
|
|
42
|
+
*/
|
|
43
|
+
export declare const getAttrs: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => any;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the children of an MDX element and returns them as an array of Text nodes.
|
|
46
|
+
* Currently only being used by the HTML Block component, which only expects a single text node.
|
|
47
|
+
*
|
|
48
|
+
* @template T
|
|
49
|
+
* @param {(MdxJsxFlowElement | MdxJsxTextElement)} jsx
|
|
50
|
+
* @returns {Array} array of child text nodes
|
|
51
|
+
*/
|
|
52
|
+
export declare const getChildren: <T>(jsx: MdxJsxFlowElement | MdxJsxTextElement) => any;
|
|
53
|
+
/**
|
|
54
|
+
* Tests if a node is an MDX element.
|
|
55
|
+
* TODO: Make this more extensible to all types of nodes. isElement(node, 'type' or ['type1', 'type2']), say
|
|
56
|
+
*
|
|
57
|
+
* @param {Node} node
|
|
58
|
+
* @returns {(node is MdxJsxFlowElement | MdxJsxTextElement)}
|
|
59
|
+
*/
|
|
60
|
+
export declare const isMDXElement: (node: Node) => node is MdxJsxFlowElement | MdxJsxTextElement;
|
|
61
|
+
/**
|
|
62
|
+
* Takes an HTML string and formats it for display in the editor. Removes leading/trailing newlines
|
|
63
|
+
* and unindents the HTML.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} html
|
|
66
|
+
* @returns {string} formatted HTML
|
|
67
|
+
*/
|
|
68
|
+
export declare const formatHTML: (html: string) => string;
|
|
69
|
+
/**
|
|
70
|
+
* Reformat HTML for the markdown/mdx by adding an indentation to each line. This assures that the
|
|
71
|
+
* HTML is indentend properly within the HTMLBlock component when rendered in the markdown/mdx.
|
|
72
|
+
*
|
|
73
|
+
* @param {string} html
|
|
74
|
+
* @param {number} [indent=2]
|
|
75
|
+
* @returns {string} re-formatted HTML
|
|
76
|
+
*/
|
|
77
|
+
export declare const reformatHTML: (html: string, indent?: number) => string;
|
package/package.json
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
"name": "@readme/markdown",
|
|
3
3
|
"description": "ReadMe's React-based Markdown parser",
|
|
4
4
|
"author": "Rafe Goldberg <rafe@readme.io>",
|
|
5
|
-
"version": "6.
|
|
5
|
+
"version": "6.89.0",
|
|
6
6
|
"main": "dist/main.node.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"browser": "dist/main.js",
|
|
8
9
|
"files": [
|
|
9
10
|
"styles",
|
|
@@ -11,104 +12,122 @@
|
|
|
11
12
|
"dist"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
|
-
"build": "webpack --mode production",
|
|
15
|
-
"
|
|
16
|
-
"lint": "
|
|
17
|
-
"lint:css": "stylelint '{components,styles}/**/*.{css,scss}'",
|
|
18
|
-
"lint:js": "eslint --ext ts,tsx,js,jsx .",
|
|
19
|
-
"prepare": "husky install",
|
|
20
|
-
"pretest": "npm run lint",
|
|
21
|
-
"prettier": "prettier --list-different --write \"./**/**.{js,jsx}\"",
|
|
15
|
+
"build": "webpack --mode production && npm run build-types",
|
|
16
|
+
"build-types": "npx tsc --declaration --emitDeclarationOnly --declarationDir ./dist --skipLibCheck",
|
|
17
|
+
"lint": "eslint . --ext .jsx --ext .js --ext .ts --ext .tsx",
|
|
22
18
|
"release": "npx semantic-release",
|
|
23
19
|
"release.dry": "npx semantic-release --dry-run",
|
|
24
|
-
"start": "webpack serve --config ./webpack.dev.js
|
|
25
|
-
"test": "
|
|
26
|
-
"test.
|
|
27
|
-
"test.browser": "jest
|
|
28
|
-
"watch": "webpack
|
|
20
|
+
"start": "webpack serve --open --mode development --config ./webpack.dev.js",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"test.ui": "vitest --ui",
|
|
23
|
+
"test.browser": "jest",
|
|
24
|
+
"watch": "webpack --watch --progress --mode development"
|
|
29
25
|
},
|
|
30
26
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
27
|
+
"@mdx-js/mdx": "^3.0.0",
|
|
28
|
+
"@readme/emojis": "^5.1.0",
|
|
29
|
+
"@readme/syntax-highlighter": "^13.1.0",
|
|
30
|
+
"copy-to-clipboard": "^3.3.2",
|
|
31
|
+
"core-js": "^3.36.1",
|
|
32
|
+
"debug": "^4.3.4",
|
|
33
|
+
"emoji-regex": "^10.2.1",
|
|
34
|
+
"estree-util-value-to-estree": "^3.1.1",
|
|
34
35
|
"gemoji": "^8.1.0",
|
|
36
|
+
"hast-util-from-html": "^2.0.1",
|
|
35
37
|
"hast-util-sanitize": "^4.0.0",
|
|
38
|
+
"hast-util-to-xast": "^3.0.0",
|
|
39
|
+
"hastscript": "^9.0.0",
|
|
36
40
|
"lodash.escape": "^4.0.1",
|
|
37
41
|
"lodash.kebabcase": "^4.1.1",
|
|
38
|
-
"mdast-util-
|
|
39
|
-
"
|
|
42
|
+
"mdast-util-find-and-replace": "^3.0.1",
|
|
43
|
+
"mdast-util-phrasing": "^4.1.0",
|
|
40
44
|
"path-browserify": "^1.0.1",
|
|
41
45
|
"process": "^0.11.10",
|
|
42
46
|
"prop-types": "^15.8.1",
|
|
43
|
-
"rehype-
|
|
44
|
-
"rehype-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"remark-
|
|
48
|
-
"remark-
|
|
49
|
-
"remark-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"remark-slug": "^6.0.0",
|
|
53
|
-
"remark-stringify": "^8.0.0",
|
|
54
|
-
"unified": "^9.2.2",
|
|
47
|
+
"rehype-remark": "^10.0.0",
|
|
48
|
+
"rehype-slug": "^6.0.0",
|
|
49
|
+
"remark": "^15.0.1",
|
|
50
|
+
"remark-frontmatter": "^5.0.0",
|
|
51
|
+
"remark-gfm": "^4.0.0",
|
|
52
|
+
"remark-mdx": "^3.0.0",
|
|
53
|
+
"remark-parse": "^11.0.0",
|
|
54
|
+
"trim": "^1.0.1",
|
|
55
|
+
"unified": "^11.0.4",
|
|
55
56
|
"unist-util-flatmap": "^1.0.0",
|
|
56
|
-
"unist-util-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"unist-util-visit": "^5.0.0",
|
|
58
|
+
"util": "^0.12.5",
|
|
59
|
+
"xast-util-to-xml": "^4.0.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
|
-
"@
|
|
62
|
+
"@mdx-js/react": "^3.0.0",
|
|
63
|
+
"@readme/variable": "^16.1.0",
|
|
62
64
|
"@tippyjs/react": "^4.1.0",
|
|
63
65
|
"react": "16.x || 17.x || 18.x",
|
|
64
66
|
"react-dom": "16.x || 17.x || 18.x"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
|
-
"@babel/core": "^7.
|
|
68
|
-
"@babel/eslint-parser": "^7.
|
|
69
|
+
"@babel/core": "^7.21.4",
|
|
70
|
+
"@babel/eslint-parser": "^7.21.3",
|
|
69
71
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
70
|
-
"@babel/plugin-proposal-
|
|
71
|
-
"@babel/plugin-proposal-
|
|
72
|
-
"@babel/plugin-
|
|
73
|
-
"@babel/
|
|
74
|
-
"@babel/
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
72
|
+
"@babel/plugin-proposal-export-default-from": "^7.23.3",
|
|
73
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
74
|
+
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
|
|
75
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
76
|
+
"@babel/plugin-transform-runtime": "^7.21.4",
|
|
77
|
+
"@babel/preset-env": "^7.21.4",
|
|
78
|
+
"@babel/preset-react": "^7.18.6",
|
|
79
|
+
"@babel/preset-typescript": "^7.21.4",
|
|
80
|
+
"@commitlint/cli": "^17.5.1",
|
|
81
|
+
"@commitlint/config-angular": "^17.4.4",
|
|
82
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
83
|
+
"@readme/eslint-config": "^14.0.0",
|
|
84
|
+
"@readme/markdown-legacy": "npm:@readme/markdown@^6.84.0",
|
|
79
85
|
"@semantic-release/changelog": "^6.0.3",
|
|
80
86
|
"@semantic-release/git": "^10.0.1",
|
|
81
87
|
"@testing-library/jest-dom": "^6.4.2",
|
|
82
|
-
"@testing-library/react": "^14
|
|
83
|
-
"
|
|
84
|
-
"
|
|
88
|
+
"@testing-library/react": "^14",
|
|
89
|
+
"@testing-library/user-event": "^14.5.2",
|
|
90
|
+
"@types/hast": "^3.0.4",
|
|
91
|
+
"@types/jest": "^29.5.12",
|
|
92
|
+
"@types/mdast": "^4.0.3",
|
|
93
|
+
"@types/mdx": "^2.0.12",
|
|
94
|
+
"@types/unist": "^3.0.2",
|
|
95
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
96
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
97
|
+
"@vitest/ui": "^1.6.0",
|
|
98
|
+
"babel-jest": "^29.5.0",
|
|
99
|
+
"babel-loader": "^9.1.2",
|
|
100
|
+
"browserify-fs": "^1.0.0",
|
|
85
101
|
"codemirror": "^5.54.0",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"husky": "^9.0.11",
|
|
102
|
+
"css-loader": "^6.7.3",
|
|
103
|
+
"eslint": "^8.37.0",
|
|
104
|
+
"hast-util-to-text": "^4.0.2",
|
|
90
105
|
"identity-obj-proxy": "^3.0.0",
|
|
91
|
-
"jest": "^
|
|
92
|
-
"jest-environment-jsdom": "^29.
|
|
93
|
-
"jest-environment-puppeteer": "^
|
|
106
|
+
"jest": "^29.5.0",
|
|
107
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
108
|
+
"jest-environment-puppeteer": "^8.0.6",
|
|
94
109
|
"jest-image-snapshot": "^6.4.0",
|
|
95
|
-
"jest-puppeteer": "^
|
|
96
|
-
"mini-css-extract-plugin": "^2.
|
|
97
|
-
"node-sass": "^
|
|
98
|
-
"postcss": "^8.4.35",
|
|
110
|
+
"jest-puppeteer": "^8.0.6",
|
|
111
|
+
"mini-css-extract-plugin": "^2.7.5",
|
|
112
|
+
"node-sass": "^8.0.0",
|
|
99
113
|
"prettier": "^3.2.5",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"sass
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"webpack": "^5.
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
114
|
+
"puppeteer": "^19.8.3",
|
|
115
|
+
"react-router-dom": "^6.22.3",
|
|
116
|
+
"remark-slug": "^7.0.1",
|
|
117
|
+
"sass": "^1.77.3",
|
|
118
|
+
"sass-loader": "^13.2.2",
|
|
119
|
+
"semantic-release": "^22.0.12",
|
|
120
|
+
"stream-browserify": "^3.0.0",
|
|
121
|
+
"string.prototype.trimend": "^1.0.6",
|
|
122
|
+
"terser-webpack-plugin": "^5.3.7",
|
|
123
|
+
"ts-loader": "^9.4.2",
|
|
124
|
+
"typescript": "^5.4.5",
|
|
125
|
+
"unist-util-map": "^4.0.0",
|
|
126
|
+
"vitest": "^1.4.0",
|
|
127
|
+
"webpack": "^5.56.0",
|
|
128
|
+
"webpack-cli": "^5.0.1",
|
|
129
|
+
"webpack-dev-server": "^4.13.2",
|
|
130
|
+
"webpack-merge": "^5.8.0"
|
|
112
131
|
},
|
|
113
132
|
"license": "MIT",
|
|
114
133
|
"homepage": "https://rdmd.readme.io",
|
|
@@ -118,37 +137,12 @@
|
|
|
118
137
|
"files": [
|
|
119
138
|
{
|
|
120
139
|
"path": "dist/main.js",
|
|
121
|
-
"maxSize": "
|
|
140
|
+
"maxSize": "1MB"
|
|
122
141
|
},
|
|
123
142
|
{
|
|
124
143
|
"path": "dist/main.node.js",
|
|
125
|
-
"maxSize": "
|
|
144
|
+
"maxSize": "750KB"
|
|
126
145
|
}
|
|
127
146
|
]
|
|
128
|
-
},
|
|
129
|
-
"commitlint": {
|
|
130
|
-
"extends": [
|
|
131
|
-
"@commitlint/config-conventional"
|
|
132
|
-
],
|
|
133
|
-
"rules": {
|
|
134
|
-
"body-max-line-length": [
|
|
135
|
-
0,
|
|
136
|
-
"always",
|
|
137
|
-
"Infinity"
|
|
138
|
-
],
|
|
139
|
-
"footer-max-line-length": [
|
|
140
|
-
0,
|
|
141
|
-
"always",
|
|
142
|
-
"Infinity"
|
|
143
|
-
],
|
|
144
|
-
"scope-case": [
|
|
145
|
-
2,
|
|
146
|
-
"never",
|
|
147
|
-
"upper-case"
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"overrides": {
|
|
152
|
-
"trim": "^1"
|
|
153
147
|
}
|
|
154
148
|
}
|
package/styles/components.scss
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const PropTypes = require('prop-types');
|
|
2
|
-
const React = require('react');
|
|
3
|
-
|
|
4
|
-
const Callout = props => {
|
|
5
|
-
const { attributes, theme, icon } = props;
|
|
6
|
-
const [title, ...content] = !props.title ? [null, props.children] : props.children;
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
// eslint-disable-next-line react/jsx-props-no-spreading, react/no-unknown-property
|
|
10
|
-
<blockquote {...attributes} className={`callout callout_${theme}`} theme={icon}>
|
|
11
|
-
<h2 className={`callout-heading${title ? '' : ' empty'}`}>
|
|
12
|
-
<span className="callout-icon">{icon}</span>
|
|
13
|
-
{title}
|
|
14
|
-
</h2>
|
|
15
|
-
{content}
|
|
16
|
-
</blockquote>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
Callout.propTypes = {
|
|
21
|
-
attributes: PropTypes.shape({}),
|
|
22
|
-
calloutStyle: PropTypes.string,
|
|
23
|
-
children: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
24
|
-
icon: PropTypes.string,
|
|
25
|
-
node: PropTypes.shape(),
|
|
26
|
-
theme: PropTypes.string,
|
|
27
|
-
title: PropTypes.string,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
Callout.defaultProps = {
|
|
31
|
-
attributes: null,
|
|
32
|
-
calloutStyle: 'info',
|
|
33
|
-
node: null,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
Callout.sanitize = sanitizeSchema => {
|
|
37
|
-
sanitizeSchema.attributes['rdme-callout'] = ['icon', 'theme', 'title'];
|
|
38
|
-
|
|
39
|
-
return sanitizeSchema;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = Callout;
|