diff --git a/quartz.config.ts b/quartz.config.ts index ab7e9908..d1fe1841 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -56,9 +56,9 @@ const config: QuartzConfig = { ], emitters: [ Plugin.ContentPage({ - head: Component.Head, - header: [Component.PageTitle, Component.Spacer, Component.Darkmode], - body: [Component.ArticleTitle, Component.ReadingTime, Component.TableOfContents, Component.Content] + head: Component.Head(), + header: [Component.PageTitle(), Component.Spacer(), Component.Darkmode()], + body: [Component.ArticleTitle(), Component.ReadingTime(), Component.TableOfContents(), Component.Content()] }) ] }, diff --git a/quartz/components/ArticleTitle.tsx b/quartz/components/ArticleTitle.tsx index 02725c67..37950c48 100644 --- a/quartz/components/ArticleTitle.tsx +++ b/quartz/components/ArticleTitle.tsx @@ -1,6 +1,6 @@ -import { QuartzComponentProps } from "./types" +import { QuartzComponentConstructor, QuartzComponentProps } from "./types" -export default function ArticleTitle({ fileData }: QuartzComponentProps) { +function ArticleTitle({ fileData }: QuartzComponentProps) { const title = fileData.frontmatter?.title const displayTitle = fileData.slug === "index" ? undefined : title if (displayTitle) { @@ -9,3 +9,5 @@ export default function ArticleTitle({ fileData }: QuartzComponentProps) { return null } } + +export default (() => ArticleTitle) satisfies QuartzComponentConstructor diff --git a/quartz/components/Body.tsx b/quartz/components/Body.tsx index b8ad34b6..0130828d 100644 --- a/quartz/components/Body.tsx +++ b/quartz/components/Body.tsx @@ -1,8 +1,8 @@ import clipboardScript from './scripts/clipboard.inline' import clipboardStyle from './styles/clipboard.scss' -import { QuartzComponentProps } from "./types" +import { QuartzComponentConstructor, QuartzComponentProps } from "./types" -export default function Body({ children }: QuartzComponentProps) { +function Body({ children }: QuartzComponentProps) { return
{children}
@@ -10,3 +10,6 @@ export default function Body({ children }: QuartzComponentProps) { Body.afterDOMLoaded = clipboardScript Body.css = clipboardStyle + +export default (() => Body) satisfies QuartzComponentConstructor + diff --git a/quartz/components/Content.tsx b/quartz/components/Content.tsx index c010f2a8..71d0f35d 100644 --- a/quartz/components/Content.tsx +++ b/quartz/components/Content.tsx @@ -1,9 +1,11 @@ -import { QuartzComponentProps } from "./types" +import { QuartzComponentConstructor, QuartzComponentProps } from "./types" import { Fragment, jsx, jsxs } from 'preact/jsx-runtime' import { toJsxRuntime } from "hast-util-to-jsx-runtime" -export default function Content({ tree }: QuartzComponentProps) { +function Content({ tree }: QuartzComponentProps) { // @ts-ignore (preact makes it angry) const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' }) return content } + +export default (() => Content) satisfies QuartzComponentConstructor diff --git a/quartz/components/Darkmode.tsx b/quartz/components/Darkmode.tsx index 2170253c..49f61c7d 100644 --- a/quartz/components/Darkmode.tsx +++ b/quartz/components/Darkmode.tsx @@ -3,8 +3,9 @@ // see: https://v8.dev/features/modules#defer import darkmodeScript from "./scripts/darkmode.inline" import styles from './styles/darkmode.scss' +import { QuartzComponentConstructor } from "./types" -export default function Darkmode() { +function Darkmode() { return