From 58d9dc0528cc5d7232ac7a237c98213ff1075f39 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 17 Aug 2023 07:55:52 +0000
Subject: [PATCH] format
---
content/features/upcoming features.md | 2 +-
quartz/util/path.test.ts | 15 +++++++++++++--
quartz/util/path.ts | 6 +++---
quartz/components/scripts/spa.inline.ts | 2 +-
quartz/bootstrap-cli.mjs | 2 +-
5 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/content/features/upcoming features.md b/content/features/upcoming features.md
index bbf962b..2045be7 100644
--- a/content/features/upcoming features.md
+++ b/content/features/upcoming features.md
@@ -5,7 +5,7 @@
## todo
- 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
- debounce cfg rebuild on large repos
- investigate content rebuild triggering multiple times even when debounced, causing an esbuild deadlock
diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index 8551e76..c1c1308 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -460,7 +460,7 @@
await build(clientRefresh)
})
} else {
- await build(() => { })
+ await build(() => {})
ctx.dispose()
}
})
diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts
index c28da28..1b44ade 100644
--- a/quartz/components/scripts/spa.inline.ts
+++ b/quartz/components/scripts/spa.inline.ts
@@ -17,7 +17,7 @@
}
return true
}
- } catch (e) { }
+ } catch (e) {}
return false
}
diff --git a/quartz/util/path.test.ts b/quartz/util/path.test.ts
index ddbb0ee..cbfd86b 100644
--- a/quartz/util/path.test.ts
+++ b/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")
diff --git a/quartz/util/path.ts b/quartz/util/path.ts
index c949474..7394a43 100644
--- a/quartz/util/path.ts
+++ b/quartz/util/path.ts
@@ -72,7 +72,7 @@
export function isRelativeURL(s: string): s is RelativeURL {
const validStart = /^\.{1,2}/.test(s)
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 */
@@ -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
}
}
--
Gitblit v1.10.0