remark
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2024-09-07 00:24:29 +03:00
parent 2e1d270837
commit 07923196fb
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C
2 changed files with 11 additions and 25 deletions

View File

@ -1,6 +1,4 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { Root } from "mdast"
import { classNames } from "../util/lang"
// @ts-ignore // @ts-ignore
// import script from "./scripts/comments.inline" // import script from "./scripts/comments.inline"
@ -28,7 +26,7 @@ export default ((opts: Options) => {
show_email_subscription: false, show_email_subscription: false,
simple_view: false simple_view: false
}; };
`; `
const embedScript = ` const embedScript = `
!function(e,n){ !function(e,n){
@ -42,28 +40,17 @@ export default ((opts: Options) => {
d.appendChild(r) d.appendChild(r)
} }
}(remark_config.components||["embed"], document); }(remark_config.components||["embed"], document);
`; `
return { return async (tree: Root, file) => {
name: "TableOfContents", <>
markdownPlugins() { <hr />
return [ <div id="remark42" style="margin-top: 2rem"></div>
() => { <script dangerouslySetInnerHTML={{ __html: remarkConfig }}></script>
return async (tree: Root, file) => { <script dangerouslySetInnerHTML={{ __html: embedScript }}></script>
// const display = file.data.frontmatter?.enableComments ?? true </>
// if (display) {
<>
<div id="remark42" style="margin-top: 2rem"></div>
<script dangerouslySetInnerHTML={{ __html: remarkConfig }}></script>
<script dangerouslySetInnerHTML={{ __html: embedScript }}></script>
</>
// }
}
}
]
}
} }
}; }
return Remark return Remark
}) satisfies QuartzComponentConstructor<Options>; }) satisfies QuartzComponentConstructor<Options>

View File

@ -234,7 +234,6 @@ export function renderPage(
</div> </div>
</div> </div>
<Content {...componentData} /> <Content {...componentData} />
<hr />
<div class="page-footer"> <div class="page-footer">
{afterBody.map((BodyComponent) => ( {afterBody.map((BodyComponent) => (
<BodyComponent {...componentData} /> <BodyComponent {...componentData} />