@readme/markdown 6.57.1 → 6.58.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/components/Code/index.jsx +3 -7
- package/dist/main.js +253 -328
- package/dist/main.node.js +252 -328
- package/package.json +1 -1
|
@@ -2,8 +2,6 @@ const copy = require('copy-to-clipboard');
|
|
|
2
2
|
const PropTypes = require('prop-types');
|
|
3
3
|
const React = require('react');
|
|
4
4
|
|
|
5
|
-
const useColorScheme = require('../../hooks/useColorScheme');
|
|
6
|
-
|
|
7
5
|
// Only load CodeMirror in the browser, for SSR
|
|
8
6
|
// apps. Necessary because of people like this:
|
|
9
7
|
// https://github.com/codemirror/CodeMirror/issues/3701#issuecomment-164904534
|
|
@@ -40,19 +38,17 @@ CopyCode.propTypes = {
|
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
function Code(props) {
|
|
43
|
-
const { children, className, copyButtons, lang, meta } = props;
|
|
41
|
+
const { children, className, copyButtons, lang, meta, theme } = props;
|
|
44
42
|
|
|
45
43
|
const langClass = className.search(/lang(?:uage)?-\w+/) >= 0 ? className.match(/\s?lang(?:uage)?-(\w+)/)[1] : '';
|
|
46
44
|
const language = canonicalLanguage(lang) || langClass;
|
|
47
45
|
|
|
48
46
|
const codeRef = React.createRef();
|
|
49
47
|
|
|
50
|
-
const colorScheme = useColorScheme.default();
|
|
51
|
-
|
|
52
48
|
const codeOpts = {
|
|
53
|
-
customTheme: colorScheme === 'light' ? 'neo' : 'material-palenight',
|
|
54
49
|
inline: !lang,
|
|
55
50
|
tokenizeVariables: true,
|
|
51
|
+
dark: theme === 'dark',
|
|
56
52
|
};
|
|
57
53
|
|
|
58
54
|
const codeContent =
|
|
@@ -63,7 +59,7 @@ function Code(props) {
|
|
|
63
59
|
{copyButtons && <CopyCode className="fa" codeRef={codeRef} />}
|
|
64
60
|
<code
|
|
65
61
|
ref={codeRef}
|
|
66
|
-
className={['rdmd-code', `lang-${language}`, `theme-${
|
|
62
|
+
className={['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' ')}
|
|
67
63
|
data-lang={language}
|
|
68
64
|
name={meta}
|
|
69
65
|
suppressHydrationWarning={true}
|