mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 01:02:35 +02:00
docs(v2): dark mode syntax highlighting (#2153)
This commit is contained in:
parent
da6966d208
commit
08ca95af01
5 changed files with 25 additions and 9 deletions
|
@ -41,9 +41,11 @@ export default ({children, className: languageClassName, metastring}) => {
|
|||
const target = useRef(null);
|
||||
const button = useRef(null);
|
||||
let highlightLines = [];
|
||||
|
||||
const {theme} = useThemeContext();
|
||||
const prismTheme =
|
||||
theme === 'dark' ? prism.darkTheme : prism.theme || defaultTheme;
|
||||
const lightModeTheme = prism.theme || defaultTheme;
|
||||
const darkModeTheme = prism.darkTheme || lightModeTheme;
|
||||
const prismTheme = theme === 'dark' ? darkModeTheme : lightModeTheme;
|
||||
|
||||
if (metastring && highlightLinesRangeRegex.test(metastring)) {
|
||||
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue