Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: main updates #119

Merged
merged 11 commits into from
Nov 5, 2023
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@monaco-editor/loader": "^1.3.2",
"@motionone/solid": "^10.14.1",
"@solid-primitives/i18n": "^1.1.0",
"@solid-primitives/keyboard": "^1.2.5",
"@solid-primitives/storage": "^1.3.1",
"@stitches/core": "^1.2.8",
"aplayer": "^1.10.1",
Expand All @@ -65,6 +66,7 @@
"copy-to-clipboard": "^3.3.2",
"flv.js": "^1.6.2",
"hls.js": "^1.2.1",
"just-once": "^2.2.0",
"lightgallery": "^2.5.0",
"mark.js": "^8.11.1",
"mitt": "^3.0.0",
Expand Down
47 changes: 47 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ import rehypeRaw from "rehype-raw"
import reMarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import "./markdown.css"
import "./katex.css"
import { Show, createEffect, createMemo, createSignal, on } from "solid-js"
import { clsx } from "clsx"
import { Box } from "@hope-ui/solid"
import { useParseText } from "~/hooks"
import { EncodingSelect } from "."
import once from "just-once"

const insertKatexCSS = once(() => {
const link = document.createElement("link")
link.rel = "stylesheet"
link.href =
"https://registry.npmmirror.com/katex/0.16.8/files/dist/katex.min.css"
document.head.appendChild(link)
})

export const Markdown = (props: {
children?: string | ArrayBuffer
Expand All @@ -31,6 +39,7 @@ export const Markdown = (props: {
createEffect(
on(md, () => {
setShow(false)
insertKatexCSS()
setTimeout(() => {
setShow(true)
hljs.highlightAll()
Expand Down
Loading