Jacky Zhao
2023-06-13 9d2024b11c7c24ec8112b5019504fc44b4e1a297
quartz/path.ts
@@ -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 @@
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