taglist, mermaid
This commit is contained in:
parent
2bfe90b7e6
commit
9d2024b11c
12 changed files with 149 additions and 41 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue