From 11cd9295b27c014f89f67a73f47e4ebc3a225723 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Tue, 3 Sep 2024 08:50:23 +0300 Subject: [PATCH] added remark42 --- quartz/components/Remark.tsx | 55 ++++++++++++++++++++++++++++++++++++ quartz/components/index.ts | 2 ++ 2 files changed, 57 insertions(+) create mode 100644 quartz/components/Remark.tsx diff --git a/quartz/components/Remark.tsx b/quartz/components/Remark.tsx new file mode 100644 index 000000000..f5fe5c9c1 --- /dev/null +++ b/quartz/components/Remark.tsx @@ -0,0 +1,55 @@ +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { classNames } from "../util/lang" +// @ts-ignore +// import script from "./scripts/comments.inline" + +type Options = { + options: { + host: string + siteId: string + locale: string + } +} + +// function boolToStringBool(b: boolean): string { +// return b ? "1" : "0" +// } + +export default ((opts: Options) => { + const Remark: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => { + const remarkConfig = ` + var remark_config = { + host: "${opts.options.host}", + site_id: "${opts.options.siteId}", + components: ["embed"], + locale: "${opts.options.locale}", + theme: localStorage.theme, + show_email_subscription: false, + simple_view: false + }; + `; + + const embedScript = ` + !function(e,n){ + for(var o=0;o + + + + ); + }; + + return Remark; +}) satisfies QuartzComponentConstructor; diff --git a/quartz/components/index.ts b/quartz/components/index.ts index 5b197941c..010a26937 100644 --- a/quartz/components/index.ts +++ b/quartz/components/index.ts @@ -20,6 +20,7 @@ import MobileOnly from "./MobileOnly" import RecentNotes from "./RecentNotes" import Breadcrumbs from "./Breadcrumbs" import Comments from "./Comments" +import Remark from "./Remark" export { ArticleTitle, @@ -44,4 +45,5 @@ export { NotFound, Breadcrumbs, Comments, + Remark }