Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(web): hide the note title from the first PDF page header

tianma-if978b2415ce46
diff --git a/apps/web/src/styles/note-print.css b/apps/web/src/styles/note-print.css
index 11ff9871..9669e54c 100644
--- a/apps/web/src/styles/note-print.css
+++ b/apps/web/src/styles/note-print.css
@@ -17,6 +17,14 @@
}
}
+/* The note title is already the first-page heading. A running header there
+ repeats the same text above it. Later pages still carry the title. */
+@page :first {
+ @top-center {
+ content: none;
+ }
+}
+
* {
box-sizing: border-box;
}
diff --git a/apps/web/src/styles/note-print.test.mjs b/apps/web/src/styles/note-print.test.mjs
new file mode 100644
index 00000000..c4d29522
--- /dev/null
+++ b/apps/web/src/styles/note-print.test.mjs
@@ -0,0 +1,23 @@
+import { readFileSync } from "node:fs";
+import { describe, expect, test } from "bun:test";
+
+const css = readFileSync(new URL("./note-print.css", import.meta.url), "utf8");
+
+const pageRule = (selector) => {
+ const marker = `@page${selector} {`;
+ const start = css.indexOf(marker);
+ expect(start).toBeGreaterThanOrEqual(0);
+ const end = css.indexOf("\n}", start);
+ return css.slice(start, end);
+};
+
+describe("note print running header", () => {
+ test("repeats the note title from the second page onward", () => {
+ expect(pageRule("")).toContain("content: string(edgeever-note-title)");
+ expect(css).toContain("string-set: edgeever-note-title content(text)");
+ });
+
+ test("leaves the first page header empty so it does not repeat the title", () => {
+ expect(pageRule(" :first")).toMatch(/@top-center\s*\{[^}]*content:\s*none;/s);
+ });
+});