mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 06:55:42 -05:00
fix: correct import mermaid in pages
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
parent
2a7ad84d66
commit
008857d168
@ -22,6 +22,10 @@ import { getStaticResourcesFromPlugins } from "./plugins"
|
|||||||
|
|
||||||
type Dependencies = Record<string, DepGraph<FilePath> | null>
|
type Dependencies = Record<string, DepGraph<FilePath> | null>
|
||||||
|
|
||||||
|
type ContentPresence = {
|
||||||
|
hasMermaid: boolean
|
||||||
|
}
|
||||||
|
|
||||||
type BuildData = {
|
type BuildData = {
|
||||||
ctx: BuildCtx
|
ctx: BuildCtx
|
||||||
ignored: GlobbyFilterFunction
|
ignored: GlobbyFilterFunction
|
||||||
@ -34,6 +38,7 @@ type BuildData = {
|
|||||||
toRemove: Set<FilePath>
|
toRemove: Set<FilePath>
|
||||||
lastBuildMs: number
|
lastBuildMs: number
|
||||||
dependencies: Dependencies
|
dependencies: Dependencies
|
||||||
|
contentPresenceChecks: ContentPresence
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileEvent = "add" | "change" | "delete"
|
type FileEvent = "add" | "change" | "delete"
|
||||||
@ -129,6 +134,7 @@ async function startServing(
|
|||||||
toRemove: new Set<FilePath>(),
|
toRemove: new Set<FilePath>(),
|
||||||
trackedAssets: new Set<FilePath>(),
|
trackedAssets: new Set<FilePath>(),
|
||||||
lastBuildMs: 0,
|
lastBuildMs: 0,
|
||||||
|
contentPresenceChecks: { hasMermaid: false },
|
||||||
}
|
}
|
||||||
|
|
||||||
const watcher = chokidar.watch(".", {
|
const watcher = chokidar.watch(".", {
|
||||||
|
|||||||
@ -1,16 +1,13 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import clipboardScript from "./scripts/clipboard.inline"
|
import clipboardScript from "./scripts/clipboard.inline"
|
||||||
import clipboardStyle from "./styles/clipboard.scss"
|
import clipboardStyle from "./styles/clipboard.scss"
|
||||||
// @ts-ignore
|
|
||||||
import mermaidScript from "./scripts/mermaid.inline"
|
|
||||||
import mermaidStyle from "./styles/mermaid.scss"
|
|
||||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||||
|
|
||||||
const Body: QuartzComponent = ({ children }: QuartzComponentProps) => {
|
const Body: QuartzComponent = ({ children }: QuartzComponentProps) => {
|
||||||
return <div id="quartz-body">{children}</div>
|
return <div id="quartz-body">{children}</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
Body.afterDOMLoaded = clipboardScript + mermaidScript
|
Body.afterDOMLoaded = clipboardScript
|
||||||
Body.css = clipboardStyle + mermaidStyle
|
Body.css = clipboardStyle
|
||||||
|
|
||||||
export default (() => Body) satisfies QuartzComponentConstructor
|
export default (() => Body) satisfies QuartzComponentConstructor
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
import { htmlToJsx } from "../../util/jsx"
|
import { htmlToJsx } from "../../util/jsx"
|
||||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
|
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
|
||||||
|
// @ts-ignore
|
||||||
|
import mermaidScript from "../scripts/mermaid.inline"
|
||||||
|
import mermaidStyle from "../styles/mermaid.scss"
|
||||||
|
|
||||||
const Content: QuartzComponent = ({ ctx, fileData, tree }: QuartzComponentProps) => {
|
const Content: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) => {
|
||||||
const content = htmlToJsx(fileData.filePath!, tree)
|
const content = htmlToJsx(fileData.filePath!, tree)
|
||||||
const classes: string[] = fileData.frontmatter?.cssclasses ?? []
|
const classes: string[] = fileData.frontmatter?.cssclasses ?? []
|
||||||
const classString = ["popover-hint", ...classes].join(" ")
|
const classString = ["popover-hint", ...classes].join(" ")
|
||||||
@ -42,4 +45,7 @@ const Content: QuartzComponent = ({ ctx, fileData, tree }: QuartzComponentProps)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Content.afterDOMLoaded = mermaidScript
|
||||||
|
Content.css = mermaidStyle
|
||||||
|
|
||||||
export default (() => Content) satisfies QuartzComponentConstructor
|
export default (() => Content) satisfies QuartzComponentConstructor
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user