Shiki settings preview (#297)

This commit is contained in:
Justice Almanzar 2022-12-07 09:33:40 -05:00 committed by GitHub
parent 49b45d8262
commit 2d08dd8a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 6 deletions

View file

@ -42,6 +42,7 @@ export interface HighlighterProps {
lang?: string;
content: string;
isPreview: boolean;
tempSettings?: Record<string, any>;
}
export const createHighlighter = (props: HighlighterProps) => (
@ -53,8 +54,13 @@ export const Highlighter = ({
lang,
content,
isPreview,
tempSettings,
}: HighlighterProps) => {
const { tryHljs, useDevIcon, bgOpacity } = useShikiSettings(["tryHljs", "useDevIcon", "bgOpacity"]);
const {
tryHljs,
useDevIcon,
bgOpacity,
} = useShikiSettings(["tryHljs", "useDevIcon", "bgOpacity"], tempSettings);
const { id: currentThemeId, theme: currentTheme } = useTheme();
const shikiLang = lang ? resolveLang(lang) : null;