@readme/markdown 6.67.0-beta.2 → 6.67.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/Code/index.jsx +3 -3
- package/components/CodeTabs/index.jsx +3 -28
- package/components/index.js +0 -1
- package/dist/main.js +26099 -122759
- package/dist/main.node.js +26452 -132949
- package/package.json +3 -12
- package/components/Div.jsx +0 -31
|
@@ -51,8 +51,8 @@ function Code(props) {
|
|
|
51
51
|
dark: theme === 'dark',
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const codeContent =
|
|
55
|
+
syntaxHighlighter && children ? syntaxHighlighter(children[0], language, codeOpts) : children?.[0] || '';
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
58
|
<React.Fragment>
|
|
@@ -78,7 +78,7 @@ function CreateCode({ copyButtons, theme }) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
Code.propTypes = {
|
|
81
|
-
children: PropTypes.
|
|
81
|
+
children: PropTypes.arrayOf(PropTypes.string),
|
|
82
82
|
className: PropTypes.string,
|
|
83
83
|
copyButtons: PropTypes.bool,
|
|
84
84
|
lang: PropTypes.string,
|
|
@@ -3,19 +3,6 @@ const PropTypes = require('prop-types');
|
|
|
3
3
|
const React = require('react');
|
|
4
4
|
const { useState } = require('react');
|
|
5
5
|
|
|
6
|
-
const traverseProps = (props, fn) => {
|
|
7
|
-
if (!props) return;
|
|
8
|
-
fn(props);
|
|
9
|
-
|
|
10
|
-
if (props && 'children' in props) {
|
|
11
|
-
if (Array.isArray(props.children)) {
|
|
12
|
-
props.children.forEach(child => child.props && traverseProps(child.props, fn));
|
|
13
|
-
} else {
|
|
14
|
-
traverseProps(props.children.props, fn);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
6
|
const CodeTabs = props => {
|
|
20
7
|
const { children, theme } = props;
|
|
21
8
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
@@ -32,17 +19,11 @@ const CodeTabs = props => {
|
|
|
32
19
|
setActiveIndex(index);
|
|
33
20
|
}
|
|
34
21
|
|
|
35
|
-
const tabs = [];
|
|
36
|
-
traverseProps(props, childProps => {
|
|
37
|
-
if ('meta' in childProps || 'lang' in childProps) {
|
|
38
|
-
tabs.push({ meta: childProps.meta, lang: childProps.lang });
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
22
|
return (
|
|
43
23
|
<div className={`CodeTabs CodeTabs_initial theme-${theme}`}>
|
|
44
24
|
<div className="CodeTabs-toolbar" role="tablist">
|
|
45
|
-
{
|
|
25
|
+
{children.map(({ props: pre }, i) => {
|
|
26
|
+
const { meta, lang } = pre.children[0].props;
|
|
46
27
|
/* istanbul ignore next */
|
|
47
28
|
return (
|
|
48
29
|
<button
|
|
@@ -66,7 +47,7 @@ const CodeTabs = props => {
|
|
|
66
47
|
};
|
|
67
48
|
|
|
68
49
|
CodeTabs.propTypes = {
|
|
69
|
-
children: PropTypes.
|
|
50
|
+
children: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
70
51
|
theme: PropTypes.string,
|
|
71
52
|
};
|
|
72
53
|
|
|
@@ -75,11 +56,5 @@ function CreateCodeTabs({ theme }) {
|
|
|
75
56
|
return props => <CodeTabs {...props} theme={theme} />;
|
|
76
57
|
}
|
|
77
58
|
|
|
78
|
-
CreateCodeTabs.sanitize = sanitizeSchema => {
|
|
79
|
-
sanitizeSchema.attributes.div = ['className', 'tabs'];
|
|
80
|
-
|
|
81
|
-
return sanitizeSchema;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
59
|
module.exports = CreateCodeTabs;
|
|
85
60
|
module.exports.CodeTabs = CodeTabs;
|
package/components/index.js
CHANGED
|
@@ -2,7 +2,6 @@ export { default as Anchor } from './Anchor';
|
|
|
2
2
|
export { default as Callout } from './Callout';
|
|
3
3
|
export { default as Code } from './Code';
|
|
4
4
|
export { default as CodeTabs } from './CodeTabs';
|
|
5
|
-
export { default as Div } from './Div';
|
|
6
5
|
export { default as Embed } from './Embed';
|
|
7
6
|
export { default as GlossaryItem } from './GlossaryItem';
|
|
8
7
|
export { default as HTMLBlock } from './HTMLBlock';
|