fix: calculate heading after latex (closes #719)
This commit is contained in:
parent
742b883256
commit
3fb3930df8
@ -45,7 +45,6 @@ const config: QuartzConfig = {
|
|||||||
plugins: {
|
plugins: {
|
||||||
transformers: [
|
transformers: [
|
||||||
Plugin.FrontMatter(),
|
Plugin.FrontMatter(),
|
||||||
Plugin.TableOfContents(),
|
|
||||||
Plugin.CreatedModifiedDate({
|
Plugin.CreatedModifiedDate({
|
||||||
// you can add 'git' here for last modified from Git
|
// you can add 'git' here for last modified from Git
|
||||||
// if you do rely on git for dates, ensure defaultDateType is 'modified'
|
// if you do rely on git for dates, ensure defaultDateType is 'modified'
|
||||||
@ -55,6 +54,7 @@ const config: QuartzConfig = {
|
|||||||
Plugin.SyntaxHighlighting(),
|
Plugin.SyntaxHighlighting(),
|
||||||
Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }),
|
Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }),
|
||||||
Plugin.GitHubFlavoredMarkdown(),
|
Plugin.GitHubFlavoredMarkdown(),
|
||||||
|
Plugin.TableOfContents(),
|
||||||
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
|
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
|
||||||
Plugin.Description(),
|
Plugin.Description(),
|
||||||
],
|
],
|
||||||
|
@ -26,6 +26,7 @@ interface TocEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const regexMdLinks = new RegExp(/\[([^\[]+)\](\(.*\))/, "g")
|
const regexMdLinks = new RegExp(/\[([^\[]+)\](\(.*\))/, "g")
|
||||||
|
const slugAnchor = new Slugger()
|
||||||
export const TableOfContents: QuartzTransformerPlugin<Partial<Options> | undefined> = (
|
export const TableOfContents: QuartzTransformerPlugin<Partial<Options> | undefined> = (
|
||||||
userOpts,
|
userOpts,
|
||||||
) => {
|
) => {
|
||||||
@ -38,7 +39,7 @@ export const TableOfContents: QuartzTransformerPlugin<Partial<Options> | undefin
|
|||||||
return async (tree: Root, file) => {
|
return async (tree: Root, file) => {
|
||||||
const display = file.data.frontmatter?.enableToc ?? opts.showByDefault
|
const display = file.data.frontmatter?.enableToc ?? opts.showByDefault
|
||||||
if (display) {
|
if (display) {
|
||||||
const slugAnchor = new Slugger()
|
slugAnchor.reset()
|
||||||
const toc: TocEntry[] = []
|
const toc: TocEntry[] = []
|
||||||
let highestDepth: number = opts.maxDepth
|
let highestDepth: number = opts.maxDepth
|
||||||
visit(tree, "heading", (node) => {
|
visit(tree, "heading", (node) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user