taglist, mermaid

This commit is contained in:
Jacky Zhao
2023-06-12 22:41:42 -07:00
parent 2bfe90b7e6
commit 9d2024b11c
12 changed files with 149 additions and 41 deletions

View File

@ -1,7 +1,5 @@
import path from 'path'
import SlugAnchor from 'github-slugger'
export const slugAnchor = new SlugAnchor()
import { slug as slugAnchor } from 'github-slugger'
function slugSegment(s: string): string {
return s.replace(/\s/g, '-')
@ -9,7 +7,7 @@ function slugSegment(s: string): string {
export function slugify(s: string): string {
const [fp, anchor] = s.split("#", 2)
const sluggedAnchor = anchor === undefined ? "" : "#" + slugAnchor.slug(anchor)
const sluggedAnchor = anchor === undefined ? "" : "#" + slugAnchor(anchor)
const withoutFileExt = fp.replace(new RegExp(path.extname(fp) + '$'), '')
const rawSlugSegments = withoutFileExt.split(path.sep)
const slugParts: string = rawSlugSegments