Возможность отключать комментарии
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bd0273e94d
commit
91313ee4b1
@ -1,4 +1,5 @@
|
||||
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
import { Root } from "mdast"
|
||||
import { classNames } from "../util/lang"
|
||||
// @ts-ignore
|
||||
// import script from "./scripts/comments.inline"
|
||||
@ -43,13 +44,25 @@ export default ((opts: Options) => {
|
||||
}(remark_config.components||["embed"], document);
|
||||
`;
|
||||
|
||||
return (
|
||||
return {
|
||||
name: "TableOfContents",
|
||||
markdownPlugins() {
|
||||
return [
|
||||
() => {
|
||||
return async (tree: Root, file) => {
|
||||
const display = file.data.frontmatter?.enableComments ?? tree
|
||||
if (display) {
|
||||
<>
|
||||
<div id="remark42" style="margin-top: 2rem"></div>
|
||||
<script dangerouslySetInnerHTML={{ __html: remarkConfig }}></script>
|
||||
<script dangerouslySetInnerHTML={{ __html: embedScript }}></script>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Remark
|
||||
|
@ -92,6 +92,7 @@ declare module "vfile" {
|
||||
draft: boolean
|
||||
lang: string
|
||||
enableToc: string
|
||||
enableComments: string
|
||||
cssclasses: string[]
|
||||
}>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user