The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: incorrect test

+3 -3
+1 -1
quartz/util/path.test.ts
··· 83 83 test("simplifySlug", () => { 84 84 asserts( 85 85 [ 86 - ["index", ""], 86 + ["index", "/"], 87 87 ["abc", "abc"], 88 88 ["abc/index", "abc/"], 89 89 ["abc/def", "abc/def"],
+2 -2
quartz/util/path.ts
··· 1 1 import { slug } from "github-slugger" 2 - import type { ElementContent, Element as HastElement } from "hast" 2 + import type { Element as HastElement } from "hast" 3 3 // this file must be isomorphic so it can't use node libs (e.g. path) 4 4 5 5 export const QUARTZ = "quartz" ··· 25 25 /** Shouldn't be a relative path and shouldn't have `/index` as an ending or a file extension. It _can_ however have a trailing slash to indicate a folder path. */ 26 26 export type SimpleSlug = SlugLike<"simple"> 27 27 export function isSimpleSlug(s: string): s is SimpleSlug { 28 - const validStart = !(s.startsWith(".") || s.startsWith("/")) 28 + const validStart = !(s.startsWith(".") || (s.length > 1 && s.startsWith("/"))) 29 29 const validEnding = !(s.endsWith("/index") || s === "index") 30 30 return validStart && !_containsForbiddenCharacters(s) && validEnding && !_hasFileExtension(s) 31 31 }