From cbae88fc4e9b98764cfccca2e85f265c4b894573 Mon Sep 17 00:00:00 2001
From: Adam Brangenberg <adambrangenberg@proton.me>
Date: Mon, 31 Jul 2023 04:08:32 +0000
Subject: [PATCH] Removing redundant properties (#356)

---
 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