/
ethyne
/
notes
Обзор
Документация
Войти
/
ethyne
/
notes
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4
quartz/plugins/transformers/syntax.ts
31 строка
711 B
Jacky Zhao
chore: ts fixes
09 авг 2024, 04:28
09 авг 2024, 04:28
39eebca
Код
Авторство
О чём код?
import { QuartzTransformerPlugin } from "../types" import rehypePrettyCode, { Options as CodeOptions, Theme as CodeTheme } from "rehype-pretty-code" interface Theme extends Record<string, CodeTheme> { light: CodeTheme dark: CodeTheme } interface Options { theme?: Theme keepBackground?: boolean } const defaultOptions: Options = { theme: { light: "github-light", dark: "github-dark", }, keepBackground: false, } export const SyntaxHighlighting: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => { const opts: CodeOptions = { ...defaultOptions, ...userOpts } return { name: "SyntaxHighlighting", htmlPlugins() { return [[rehypePrettyCode, opts]] }, } }