feat: register j/tsx syntax highlight (#455)

This commit is contained in:
enpitsulin 2023-04-29 04:32:53 +08:00 committed by GitHub
parent d51b713d2c
commit 4d036d1958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import { ReactElement, createElement } from "react"
import { toast } from "react-hot-toast"
import { Element } from "react-scroll"
import { refractor } from "refractor"
import jsx from "refractor/lang/jsx"
import tsx from "refractor/lang/tsx"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import rehypeInferDescriptionMeta from "rehype-infer-description-meta"
import rehypeKatex from "rehype-katex"
@ -69,6 +71,8 @@ export type Rendered = {
}
refractor.alias("html", ["svelte", "vue"])
refractor.register(tsx)
refractor.register(jsx)
const rehypePrism = rehypePrismGenerator(refractor)