mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-13 08:12:48 +02:00
chore: upgrade syntax highlighting dependencies, prism-react-renderer
to v2, react-live
to v4 (#9316)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
df42d891c2
commit
dceaae41d7
26 changed files with 124 additions and 137 deletions
|
@ -7,7 +7,7 @@
|
|||
|
||||
import type {CSSProperties} from 'react';
|
||||
import rangeParser from 'parse-numeric-range';
|
||||
import type {PrismTheme} from 'prism-react-renderer';
|
||||
import type {PrismTheme, PrismThemeEntry} from 'prism-react-renderer';
|
||||
|
||||
const codeBlockTitleRegex = /title=(?<quote>["'])(?<title>.*?)\1/;
|
||||
const metastringLinesRangeRegex = /\{(?<range>[\d,-]+)\}/;
|
||||
|
@ -254,14 +254,14 @@ export function parseLines(
|
|||
}
|
||||
|
||||
export function getPrismCssVariables(prismTheme: PrismTheme): CSSProperties {
|
||||
const mapping: {[name: keyof PrismTheme['plain']]: string} = {
|
||||
const mapping: PrismThemeEntry = {
|
||||
color: '--prism-color',
|
||||
backgroundColor: '--prism-background-color',
|
||||
};
|
||||
|
||||
const properties: {[key: string]: string} = {};
|
||||
Object.entries(prismTheme.plain).forEach(([key, value]) => {
|
||||
const varName = mapping[key];
|
||||
const varName = mapping[key as keyof PrismThemeEntry];
|
||||
if (varName && typeof value === 'string') {
|
||||
properties[varName] = value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue