The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: toc for cyrillic and other non-latin alphabets (closes #396)

+4 -3
+1 -1
quartz/components/scripts/spa.inline.ts
··· 64 64 // scroll into place and add history 65 65 if (!isBack) { 66 66 if (url.hash) { 67 - const el = document.getElementById(url.hash.substring(1)) 67 + const el = document.getElementById(decodeURIComponent(url.hash.substring(1))) 68 68 el?.scrollIntoView() 69 69 } else { 70 70 window.scrollTo({ top: 0 })
+3 -2
quartz/plugins/transformers/toc.ts
··· 2 2 import { Root } from "mdast" 3 3 import { visit } from "unist-util-visit" 4 4 import { toString } from "mdast-util-to-string" 5 - import { slug as slugAnchor } from "github-slugger" 5 + import Slugger from "github-slugger" 6 6 7 7 export interface Options { 8 8 maxDepth: 1 | 2 | 3 | 4 | 5 | 6 ··· 34 34 return async (tree: Root, file) => { 35 35 const display = file.data.frontmatter?.enableToc ?? opts.showByDefault 36 36 if (display) { 37 + const slugAnchor = new Slugger() 37 38 const toc: TocEntry[] = [] 38 39 let highestDepth: number = opts.maxDepth 39 40 visit(tree, "heading", (node) => { ··· 43 44 toc.push({ 44 45 depth: node.depth, 45 46 text, 46 - slug: slugAnchor(text), 47 + slug: slugAnchor.slug(text), 47 48 }) 48 49 } 49 50 })