Skip to content

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

style(editor): remove pill background and dot from numbered h3 headings

tianma-if7d11d6208423
diff --git a/apps/web/src/lib/note-print-appearance.ts b/apps/web/src/lib/note-print-appearance.ts
index 00d82214..ab9df763 100644
--- a/apps/web/src/lib/note-print-appearance.ts
+++ b/apps/web/src/lib/note-print-appearance.ts
@@ -114,8 +114,7 @@ const proseStyleRules = (
".edgeever-print-content h4 { font-size: var(--editor-body-font-size, 16px); }",
`.edgeever-print-content h2 { font-size: calc(var(--editor-body-font-size, 16px) * 1.4); counter-increment: note-prose-h2; padding-bottom: 6px; border-bottom: 2px solid ${divider}; }`,
`.edgeever-print-content h2::before { content: counter(note-prose-h2, decimal-leading-zero) " · "; color: ${accent}; font-weight: 800; letter-spacing: 0.04em; }`,
- `.edgeever-print-content h3 { position: relative; display: block; width: fit-content; max-width: 100%; box-sizing: border-box; font-size: var(--editor-body-font-size, 16px); font-weight: 700; line-height: 1.5; margin: 1.5em 0 0.6em; padding: 0.25em 0.75em 0.25em 1.5em; border: 0; border-radius: 1em; background: color-mix(in srgb, ${accent} 9%, transparent); color: ${accent}; overflow-wrap: anywhere; }`,
- `.edgeever-print-content h3::before { content: ""; position: absolute; left: 0.75em; top: 0.8125em; width: 0.375em; height: 0.375em; border-radius: 50%; background: ${accent}; }`,
+ `.edgeever-print-content h3 { display: block; font-size: calc(var(--editor-body-font-size, 16px) * 1.15); font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; margin: 1.6em 0 0.6em; color: #111827; }`,
);
}
if (proseStyle.quoteStyle === "dashed") {
diff --git a/apps/web/src/lib/wechat-copy.test.mjs b/apps/web/src/lib/wechat-copy.test.mjs
index a668221a..26068f70 100644
--- a/apps/web/src/lib/wechat-copy.test.mjs
+++ b/apps/web/src/lib/wechat-copy.test.mjs
@@ -237,8 +237,9 @@ describe("preparePublishArticle", () => {
expect(h2?.textContent).toContain("章节标题");
expect(h2?.querySelector("[data-ee-heading-number]")?.innerHTML).toContain("#059669");
const h3 = root.querySelector("h3");
- expect(css(h3)).toContain("border-radius:1em");
- expect(h3?.querySelector("[data-ee-pill-dot]")).not.toBeNull();
+ expect(css(h3)).not.toContain("border-radius:1em");
+ expect(h3?.querySelector("[data-ee-pill-dot]")).toBeNull();
+ expect(css(h3)).toContain("font-weight:700");
const quote = root.querySelector("blockquote");
expect(css(quote)).toContain("border:1px dashed #d1d5db");
expect(css(quote)).toContain("background:#f9fafb");
@@ -256,7 +257,7 @@ describe("preparePublishArticle", () => {
}
});
- test("numbered headings follow body size while preserving the wrapping pill", () => {
+ test("numbered headings follow body size in clean editorial hierarchy", () => {
const container = document.createElement("div");
container.dataset.notePalette = "native";
container.dataset.noteHeadingStyle = "numbered";
@@ -267,14 +268,13 @@ describe("preparePublishArticle", () => {
getPropertyValue: (name) => name === "--editor-body-font-size" ? `${size}px` : "",
});
const root = preparePublishArticle("<h2>章节</h2><h3>包含 <strong>强调</strong> 的长标题</h3><h4>子标题</h4><p>正文</p>", container);
- expect(root.querySelector("h3").style.fontSize).toBe(`${size}px`);
+ expect(root.querySelector("h3").style.fontSize).toBe(`${Math.round(size * 1.15)}px`);
expect(root.querySelector("h4").style.fontSize).toBe(`${size}px`);
expect(root.querySelector("p:not([data-ee-publish-chrome])").style.fontSize).toBe(`${size}px`);
const h2Title = Array.from(root.querySelectorAll("h2 p")).find((p) => p.textContent === "章节");
expect(h2Title.style.fontSize).toBe(`${size * 1.4}px`);
- expect(css(root.querySelector("h3"))).toContain("max-width:100%");
expect(root.querySelector("h3 strong").textContent).toBe("强调");
- expect(root.querySelectorAll("[data-ee-pill-dot]").length).toBe(1);
+ expect(root.querySelectorAll("[data-ee-pill-dot]").length).toBe(0);
}
} finally {
globalThis.getComputedStyle = previous;
diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts
index e7c77e6e..ee72fbcf 100644
--- a/apps/web/src/lib/wechat-copy.ts
+++ b/apps/web/src/lib/wechat-copy.ts
@@ -89,7 +89,7 @@ const applyLegacyWeChatStyles = (
const h3Style = proseStyle.headingStyle === "bar"
? `${h3Base.replace(/padding:\s*0;/, "padding: 0 0 0 8px;")} border-left: 3px solid ${accent};`
: proseStyle.headingStyle === "numbered"
- ? `display: block; width: fit-content; max-width: 100%; box-sizing: border-box; margin: 1.5em 0 0.6em; padding: 0.25em 0.75em 0.25em 1.5em; text-indent: -0.75em; overflow-wrap: anywhere; border-radius: 1em; background: ${surface}; color: ${accent}; font-family: ${PUBLISH_FONT}; font-size: ${fontSize}; font-weight: 700; line-height: 1.5;`
+ ? `margin: 1.6em 0 0.6em; padding: 0; font-family: ${PUBLISH_FONT}; font-size: ${Math.round(metrics.fontSize * 1.15)}px; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; color: #111827; text-align: left;`
: h3Base;
const h4Style = proseStyle.headingStyle === "numbered"
? `display: inline-block; margin: 16px 0 8px; padding: 1px 6px; border-radius: 3px; background: #fde68a; color: #111827; font-family: ${PUBLISH_FONT}; font-size: ${fontSize}; font-weight: 800; line-height: 1.5;`
@@ -267,16 +267,6 @@ const applyLegacyWeChatStyles = (
`</section>`,
].join("");
});
-
- root.querySelectorAll<HTMLElement>("h3").forEach((heading) => {
- if (heading.querySelector("[data-ee-pill-dot]")) return;
- const dot = document.createElement("span");
- dot.setAttribute("data-ee-publish-chrome", "true");
- dot.setAttribute("data-ee-pill-dot", "true");
- dot.style.cssText = `display: inline-block; width: 0.375em; height: 0.375em; background: ${accent}; border-radius: 50%; margin-right: 0.375em; text-indent: 0; vertical-align: middle;`;
- dot.innerHTML = "<span leaf=\"\"><br></span>";
- heading.insertBefore(dot, heading.firstChild);
- });
}
root.querySelectorAll<HTMLElement>("pre code").forEach((element) => {
diff --git a/apps/web/src/styles/note-prose-styles.css b/apps/web/src/styles/note-prose-styles.css
index 3b0c2ddb..2958a822 100644
--- a/apps/web/src/styles/note-prose-styles.css
+++ b/apps/web/src/styles/note-prose-styles.css
@@ -191,38 +191,22 @@
content: "SUMMARY";
}
-/* H3: Body-relative pill heading; bounded corners also suit wrapped titles. */
+/* H3: Clean editorial section heading without pill background */
.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h3,
.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h3 {
- position: relative;
display: block;
- width: fit-content;
- max-width: 100%;
- box-sizing: border-box;
- margin-top: 1.5em;
+ margin-top: 1.6em;
margin-bottom: 0.6em;
- padding: 0.25em 0.75em 0.25em 1.5em;
- overflow-wrap: anywhere;
- border: 0;
- border-radius: 1em;
- background: color-mix(in srgb, var(--note-palette-accent, #374151) 9%, transparent);
- color: var(--note-palette-accent, #374151);
- font-size: var(--editor-body-font-size, 16px);
+ font-size: calc(var(--editor-body-font-size, 16px) * 1.15);
font-weight: 700;
- line-height: 1.5;
+ line-height: 1.4;
+ letter-spacing: -0.01em;
+ color: #111827;
}
-.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h3::before,
-.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h3::before {
- content: "";
- position: absolute;
- left: 0.75em;
- top: 0.8125em;
- width: 0.375em;
- height: 0.375em;
- border-radius: 50%;
- background: var(--note-palette-accent, #374151);
- pointer-events: none;
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h3,
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content h3 {
+ color: #f3f4f6;
}
/* H4: Warm yellow highlight sub-heading */