Возможность отключать комментарии
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 { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||||
|
import { Root } from "mdast"
|
||||||
import { classNames } from "../util/lang"
|
import { classNames } from "../util/lang"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
// import script from "./scripts/comments.inline"
|
// import script from "./scripts/comments.inline"
|
||||||
@ -43,13 +44,25 @@ export default ((opts: Options) => {
|
|||||||
}(remark_config.components||["embed"], document);
|
}(remark_config.components||["embed"], document);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
return (
|
return {
|
||||||
<>
|
name: "TableOfContents",
|
||||||
<div id="remark42" style="margin-top: 2rem"></div>
|
markdownPlugins() {
|
||||||
<script dangerouslySetInnerHTML={{ __html: remarkConfig }}></script>
|
return [
|
||||||
<script dangerouslySetInnerHTML={{ __html: embedScript }}></script>
|
() => {
|
||||||
</>
|
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
|
return Remark
|
||||||
|
@ -92,6 +92,7 @@ declare module "vfile" {
|
|||||||
draft: boolean
|
draft: boolean
|
||||||
lang: string
|
lang: string
|
||||||
enableToc: string
|
enableToc: string
|
||||||
|
enableComments: string
|
||||||
cssclasses: string[]
|
cssclasses: string[]
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user