Jacky Zhao
2023-08-17 58d9dc0528cc5d7232ac7a237c98213ff1075f39
format
5 files modified
19 ■■■■ changed files
content/features/upcoming features.md patch | view | raw | blame | history
quartz/bootstrap-cli.mjs patch | view | raw | blame | history
quartz/components/scripts/spa.inline.ts patch | view | raw | blame | history
quartz/util/path.test.ts 15 ●●●● patch | view | raw | blame | history
quartz/util/path.ts 4 ●●●● patch | view | raw | blame | history
content/features/upcoming features.md
quartz/bootstrap-cli.mjs
quartz/components/scripts/spa.inline.ts
quartz/util/path.test.ts
@@ -198,7 +198,15 @@
})
describe("link strategies", () => {
  const allSlugs = ["a/b/c", "a/b/d", "a/b/index", "e/f", "e/g/h", "index", "a/test.png"] as ServerSlug[]
  const allSlugs = [
    "a/b/c",
    "a/b/d",
    "a/b/index",
    "e/f",
    "e/g/h",
    "index",
    "a/test.png",
  ] as ServerSlug[]
  describe("absolute", () => {
    const opts: TransformOptions = {
@@ -285,7 +293,10 @@
      assert.strictEqual(path.transformLink(cur, "../../../index.png", opts), "../../../index.png")
      assert.strictEqual(path.transformLink(cur, "../../../index#abc", opts), "../../../#abc")
      assert.strictEqual(path.transformLink(cur, "../../../", opts), "../../../")
      assert.strictEqual(path.transformLink(cur, "../../../a/test.png", opts), "../../../a/test.png")
      assert.strictEqual(
        path.transformLink(cur, "../../../a/test.png", opts),
        "../../../a/test.png",
      )
      assert.strictEqual(path.transformLink(cur, "../../../e/g/h", opts), "../../../e/g/h")
      assert.strictEqual(path.transformLink(cur, "../../../e/g/h", opts), "../../../e/g/h")
      assert.strictEqual(path.transformLink(cur, "../../../e/g/h#abc", opts), "../../../e/g/h#abc")
quartz/util/path.ts
@@ -133,7 +133,7 @@
    slug = slug.replace(/_index$/, "index")
  }
  return slug + ext as ServerSlug
  return (slug + ext) as ServerSlug
}
export function transformInternalLink(link: string): RelativeURL {
@@ -239,7 +239,7 @@
    }
    // if it's not unique, then it's the absolute path from the vault root
    return joinSegments(pathToRoot(src), canonicalSlug) + folderTail as RelativeURL
    return (joinSegments(pathToRoot(src), canonicalSlug) + folderTail) as RelativeURL
  }
}