@readme/markdown 6.75.0-beta.16 → 6.75.0-beta.21
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 +17 -18
- package/components/TableOfContents/index.jsx +4 -4
- package/dist/main.js +1333 -519
- package/dist/main.node.js +1312 -515
- package/package.json +8 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import copy from 'copy-to-clipboard';
|
|
2
|
+
import { string, oneOfType, func, shape, instanceOf, arrayOf, bool } from 'prop-types';
|
|
3
|
+
import React, { createRef, Element, Fragment } from 'react';
|
|
4
4
|
|
|
5
5
|
// Only load CodeMirror in the browser, for SSR
|
|
6
6
|
// apps. Necessary because of people like this:
|
|
@@ -16,7 +16,7 @@ if (typeof window !== 'undefined') {
|
|
|
16
16
|
|
|
17
17
|
function CopyCode({ codeRef, rootClass = 'rdmd-code-copy', className = '' }) {
|
|
18
18
|
const copyClass = `${rootClass}_copied`;
|
|
19
|
-
const button =
|
|
19
|
+
const button = createRef();
|
|
20
20
|
/* istanbul ignore next */
|
|
21
21
|
const copier = () => {
|
|
22
22
|
const code = codeRef.current.textContent;
|
|
@@ -31,10 +31,9 @@ function CopyCode({ codeRef, rootClass = 'rdmd-code-copy', className = '' }) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
CopyCode.propTypes = {
|
|
34
|
-
className:
|
|
35
|
-
codeRef:
|
|
36
|
-
|
|
37
|
-
rootClass: PropTypes.string,
|
|
34
|
+
className: string,
|
|
35
|
+
codeRef: oneOfType([func, shape({ current: instanceOf(Element) })]).isRequired,
|
|
36
|
+
rootClass: string,
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
function Code(props) {
|
|
@@ -43,7 +42,7 @@ function Code(props) {
|
|
|
43
42
|
const langClass = className.search(/lang(?:uage)?-\w+/) >= 0 ? className.match(/\s?lang(?:uage)?-(\w+)/)[1] : '';
|
|
44
43
|
const language = canonicalLanguage(lang) || langClass;
|
|
45
44
|
|
|
46
|
-
const codeRef =
|
|
45
|
+
const codeRef = createRef();
|
|
47
46
|
|
|
48
47
|
const codeOpts = {
|
|
49
48
|
inline: !lang,
|
|
@@ -55,7 +54,7 @@ function Code(props) {
|
|
|
55
54
|
syntaxHighlighter && children ? syntaxHighlighter(children[0], language, codeOpts) : children?.[0] || '';
|
|
56
55
|
|
|
57
56
|
return (
|
|
58
|
-
<
|
|
57
|
+
<Fragment>
|
|
59
58
|
{copyButtons && <CopyCode className="fa" codeRef={codeRef} />}
|
|
60
59
|
<code
|
|
61
60
|
ref={codeRef}
|
|
@@ -66,7 +65,7 @@ function Code(props) {
|
|
|
66
65
|
>
|
|
67
66
|
{codeContent}
|
|
68
67
|
</code>
|
|
69
|
-
</
|
|
68
|
+
</Fragment>
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -76,12 +75,12 @@ function CreateCode({ copyButtons, theme }) {
|
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
Code.propTypes = {
|
|
79
|
-
children:
|
|
80
|
-
className:
|
|
81
|
-
copyButtons:
|
|
82
|
-
lang:
|
|
83
|
-
meta:
|
|
84
|
-
theme:
|
|
78
|
+
children: arrayOf(string),
|
|
79
|
+
className: string,
|
|
80
|
+
copyButtons: bool,
|
|
81
|
+
lang: string,
|
|
82
|
+
meta: string,
|
|
83
|
+
theme: string,
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
Code.defaultProps = {
|
|
@@ -98,4 +97,4 @@ CreateCode.sanitize = sanitizeSchema => {
|
|
|
98
97
|
return sanitizeSchema;
|
|
99
98
|
};
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
export default CreateCode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { element } from 'prop-types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
4
|
function TableOfContents({ children }) {
|
|
5
5
|
return (
|
|
@@ -19,7 +19,7 @@ function TableOfContents({ children }) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
TableOfContents.propTypes = {
|
|
22
|
-
children:
|
|
22
|
+
children: element,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
export default TableOfContents;
|