format
This commit is contained in:
		@@ -5,7 +5,7 @@ draft: true
 | 
				
			|||||||
## todo
 | 
					## todo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- static icon path (in head) never gets updated
 | 
					- static icon path (in head) never gets updated
 | 
				
			||||||
	- do we update relative links on spa?
 | 
					  - do we update relative links on spa?
 | 
				
			||||||
- back button with anchors / popovers + spa is broken
 | 
					- back button with anchors / popovers + spa is broken
 | 
				
			||||||
- debounce cfg rebuild on large repos
 | 
					- debounce cfg rebuild on large repos
 | 
				
			||||||
  - investigate content rebuild triggering multiple times even when debounced, causing an esbuild deadlock
 | 
					  - investigate content rebuild triggering multiple times even when debounced, causing an esbuild deadlock
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -460,7 +460,7 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
 | 
				
			|||||||
          await build(clientRefresh)
 | 
					          await build(clientRefresh)
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      await build(() => { })
 | 
					      await build(() => {})
 | 
				
			||||||
      ctx.dispose()
 | 
					      ctx.dispose()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ const isLocalUrl = (href: string) => {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      return true
 | 
					      return true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } catch (e) { }
 | 
					  } catch (e) {}
 | 
				
			||||||
  return false
 | 
					  return false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -198,7 +198,15 @@ describe("transforms", () => {
 | 
				
			|||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe("link strategies", () => {
 | 
					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", () => {
 | 
					  describe("absolute", () => {
 | 
				
			||||||
    const opts: TransformOptions = {
 | 
					    const opts: TransformOptions = {
 | 
				
			||||||
@@ -285,7 +293,10 @@ describe("link strategies", () => {
 | 
				
			|||||||
      assert.strictEqual(path.transformLink(cur, "../../../index.png", opts), "../../../index.png")
 | 
					      assert.strictEqual(path.transformLink(cur, "../../../index.png", opts), "../../../index.png")
 | 
				
			||||||
      assert.strictEqual(path.transformLink(cur, "../../../index#abc", opts), "../../../#abc")
 | 
					      assert.strictEqual(path.transformLink(cur, "../../../index#abc", opts), "../../../#abc")
 | 
				
			||||||
      assert.strictEqual(path.transformLink(cur, "../../../", opts), "../../../")
 | 
					      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", 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")
 | 
					      assert.strictEqual(path.transformLink(cur, "../../../e/g/h#abc", opts), "../../../e/g/h#abc")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ export type RelativeURL = SlugLike<"relative">
 | 
				
			|||||||
export function isRelativeURL(s: string): s is RelativeURL {
 | 
					export function isRelativeURL(s: string): s is RelativeURL {
 | 
				
			||||||
  const validStart = /^\.{1,2}/.test(s)
 | 
					  const validStart = /^\.{1,2}/.test(s)
 | 
				
			||||||
  const validEnding = !(s.endsWith("/index") || s === "index")
 | 
					  const validEnding = !(s.endsWith("/index") || s === "index")
 | 
				
			||||||
  return validStart && validEnding && ![".md", ".html"].includes(_getFileExtension(s) ?? "") 
 | 
					  return validStart && validEnding && ![".md", ".html"].includes(_getFileExtension(s) ?? "")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** A server side slug. This is what Quartz uses to emit files so uses index suffixes */
 | 
					/** A server side slug. This is what Quartz uses to emit files so uses index suffixes */
 | 
				
			||||||
@@ -133,7 +133,7 @@ export function slugifyFilePath(fp: FilePath, excludeExt?: boolean): ServerSlug
 | 
				
			|||||||
    slug = slug.replace(/_index$/, "index")
 | 
					    slug = slug.replace(/_index$/, "index")
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return slug + ext as ServerSlug
 | 
					  return (slug + ext) as ServerSlug
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function transformInternalLink(link: string): RelativeURL {
 | 
					export function transformInternalLink(link: string): RelativeURL {
 | 
				
			||||||
@@ -239,7 +239,7 @@ export function transformLink(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // if it's not unique, then it's the absolute path from the vault root
 | 
					    // 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
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user