| | |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "../types" |
| | | import { Fragment, jsx, jsxs } from 'preact/jsx-runtime' |
| | | import { toJsxRuntime } from "hast-util-to-jsx-runtime" |
| | | import { ComponentChildren } from "preact" |
| | | import { htmlToJsx } from "../../util/jsx" |
| | | import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types" |
| | | |
| | | function Content({ tree }: QuartzComponentProps) { |
| | | // @ts-ignore (preact makes it angry) |
| | | const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' }) |
| | | return <article>{content}</article> |
| | | const Content: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) => { |
| | | const content = htmlToJsx(fileData.filePath!, tree) as ComponentChildren |
| | | const classes: string[] = fileData.frontmatter?.cssclasses ?? [] |
| | | const classString = ["popover-hint", ...classes].join(" ") |
| | | return <article class={classString}>{content}</article> |
| | | } |
| | | |
| | | export default (() => Content) satisfies QuartzComponentConstructor |
| | | export default (() => Content) satisfies QuartzComponentConstructor |