From cee2883c0889a65e2786d70eb81932f5ed017e59 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Wed, 26 Jul 2023 04:10:37 +0000
Subject: [PATCH] nested tag support and tag index page
---
quartz/path.ts | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/quartz/path.ts b/quartz/path.ts
index 0d3a0c6..fca2c05 100644
--- a/quartz/path.ts
+++ b/quartz/path.ts
@@ -1,4 +1,4 @@
-import { slug as slugAnchor } from "github-slugger"
+import { slug } from "github-slugger"
import { trace } from "./trace"
// Quartz Paths
@@ -197,10 +197,30 @@
return [fp, anchor]
}
+export function slugAnchor(anchor: string) {
+ return slug(anchor)
+}
+
+export function slugTag(tag: string) {
+ return tag
+ .split("/")
+ .map((tagSegment) => slug(tagSegment))
+ .join("/")
+}
+
export function joinSegments(...args: string[]): string {
return args.filter((segment) => segment !== "").join("/")
}
+export function getAllSegmentPrefixes(tags: string): string[] {
+ const segments = tags.split("/")
+ const results: string[] = []
+ for (let i = 0; i < segments.length; i++) {
+ results.push(segments.slice(0, i + 1).join("/"))
+ }
+ return results
+}
+
export const QUARTZ = "quartz"
function _canonicalize(fp: string): string {
--
Gitblit v1.10.0