AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
feat(web): support rich-text headings through level 6 (#413)
tianma-ifdcf2c138cbe0
diff --git a/apps/ios/EditorSource/src/styles.css b/apps/ios/EditorSource/src/styles.cssindex b1644b21..7b365822 100644--- a/apps/ios/EditorSource/src/styles.css+++ b/apps/ios/EditorSource/src/styles.css@@ -819,12 +819,36 @@ html[data-theme="dark"] .ProseMirror pre code {.edgeever-prose h1,.edgeever-prose h2,.edgeever-prose h3,+.edgeever-prose h4,+.edgeever-prose h5,+.edgeever-prose h6,.ProseMirror h1,.ProseMirror h2,-.ProseMirror h3 {+.ProseMirror h3,+.ProseMirror h4,+.ProseMirror h5,+.ProseMirror h6 {line-height: 1.25;}+.edgeever-prose h4,+.ProseMirror h4 {+ font-size: 1.05rem;+ font-weight: 650;+}++.edgeever-prose h5,+.ProseMirror h5 {+ font-size: 1rem;+ font-weight: 650;+}++.edgeever-prose h6,+.ProseMirror h6 {+ font-size: 0.95rem;+ font-weight: 650;+}+.edgeever-mermaid {overflow-x: auto;margin: 12px 0;@@ -883,7 +907,7 @@ body.viewer-mode #toolbar {.edgeever-image-meta { margin: 0 0 28px; padding-bottom: 18px; border-bottom: 1px solid #e2e8f0; color: #64748b; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }.edgeever-image-content { font-size: 17px; line-height: 1.82; }.edgeever-image-content, .edgeever-image-content .tiptap { min-height: 0 !important; height: auto !important; overflow: visible !important; background: #fff !important; color: #172033 !important; }-.edgeever-image-content h1, .edgeever-image-content h2, .edgeever-image-content h3 { color: #0f172a !important; }+.edgeever-image-content h1, .edgeever-image-content h2, .edgeever-image-content h3, .edgeever-image-content h4, .edgeever-image-content h5, .edgeever-image-content h6 { color: #0f172a !important; }.edgeever-image-content pre { background: #f1f5f9 !important; color: #172033 !important; }.edgeever-image-content code { color: inherit !important; }.edgeever-image-content blockquote { color: #475569 !important; border-color: #94a3b8 !important; }diff --git a/apps/mobile/src/components/LocalTiptapEditor.tsx b/apps/mobile/src/components/LocalTiptapEditor.tsxindex 7e1b855c..6eed6e3b 100644--- a/apps/mobile/src/components/LocalTiptapEditor.tsx+++ b/apps/mobile/src/components/LocalTiptapEditor.tsx@@ -3104,7 +3104,10 @@ const getEditorStyles = (theme: "light" | "dark", options?: { viewer?: boolean }.edgeever-editor-content p.is-editor-empty:first-child::before { float: left; height: 0; color: #94a3b8; content: attr(data-placeholder); pointer-events: none; }.edgeever-editor-content h1,.edgeever-editor-content h2,- .edgeever-editor-content h3 {+ .edgeever-editor-content h3,+ .edgeever-editor-content h4,+ .edgeever-editor-content h5,+ .edgeever-editor-content h6 {max-width: 100%;overflow-wrap: anywhere;line-height: 1.3;@@ -3113,6 +3116,9 @@ const getEditorStyles = (theme: "light" | "dark", options?: { viewer?: boolean }.edgeever-editor-content h1 { margin: 0.7em 0 0.4em; font-size: 1.6rem; }.edgeever-editor-content h2 { margin: 0.85em 0 0.35em; font-size: 1.35rem; }.edgeever-editor-content h3 { margin: 0.75em 0 0.3em; font-size: 1.15rem; }+ .edgeever-editor-content h4 { margin: 0.7em 0 0.28em; font-size: 1.05rem; font-weight: 700; }+ .edgeever-editor-content h5 { margin: 0.65em 0 0.25em; font-size: 1rem; font-weight: 700; }+ .edgeever-editor-content h6 { margin: 0.6em 0 0.22em; font-size: 0.95rem; font-weight: 700; }.edgeever-editor-content ul[data-type="taskList"] { margin: 0 0 var(--editor-paragraph-spacing); padding-left: 0; list-style: none; }.edgeever-editor-content ul[data-type="taskList"] li[data-checked] { display: flex; align-items: flex-start; gap: 9px; margin: 4px 0; }.edgeever-editor-content ul[data-type="taskList"] li[data-checked] > label { display: inline-flex; flex: 0 0 auto; align-items: center; margin-top: 3px; user-select: none; }diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsxindex 2ef4fb8f..10cf9c4c 100644--- a/apps/web/src/components/EditorPane.tsx+++ b/apps/web/src/components/EditorPane.tsx@@ -598,6 +598,9 @@ const RichEditorPane = ({"heading-1": "","heading-2": "","heading-3": "",+ "heading-4": "",+ "heading-5": "",+ "heading-6": "","bullet-list": "","ordered-list": "","task-list": "",@@ -628,6 +631,9 @@ const RichEditorPane = ({"heading-1": t("editorToolbar.heading1"),"heading-2": t("editorToolbar.heading2"),"heading-3": t("editorToolbar.heading3"),+ "heading-4": t("editorToolbar.heading4"),+ "heading-5": t("editorToolbar.heading5"),+ "heading-6": t("editorToolbar.heading6"),"bullet-list": t("editorToolbar.bulletList"),"ordered-list": t("editorToolbar.orderedList"),"task-list": t("editorToolbar.taskList"),diff --git a/apps/web/src/components/EditorPhonePreview.tsx b/apps/web/src/components/EditorPhonePreview.tsxindex 49aa3e6f..1fce6669 100644--- a/apps/web/src/components/EditorPhonePreview.tsx+++ b/apps/web/src/components/EditorPhonePreview.tsx@@ -28,7 +28,7 @@ type EditorPhonePreviewProps = {};const BLOCK_SELECTOR =- "p, h1, h2, h3, li, blockquote, pre, img, table, hr, figure, [data-edgeever-theme-block]";+ "p, h1, h2, h3, h4, h5, h6, li, blockquote, pre, img, table, hr, figure, [data-edgeever-theme-block]";export const collectPhonePreviewBlocks = (root: Element) =>[...root.querySelectorAll<HTMLElement>(BLOCK_SELECTOR)].filter((element) => {diff --git a/apps/web/src/components/EditorToolbar.tsx b/apps/web/src/components/EditorToolbar.tsxindex d105167d..5b6e7c8e 100644--- a/apps/web/src/components/EditorToolbar.tsx+++ b/apps/web/src/components/EditorToolbar.tsx@@ -26,8 +26,10 @@ import { MemoEditorToolbarDivider, MemoEditorToolbarRow } from "@/components/Memimport { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "@/components/ui/select";import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";import {+ EDITOR_HEADING_LEVELS,formatShortcutBinding,getActiveBlockValue,+ parseHeadingBlockValue,readEditorToolbarExpandedPreference,writeEditorToolbarExpandedPreference,type ShortcutBinding,@@ -270,18 +272,9 @@ export const EditorToolbar = ({return;}- if (value === "heading-1") {- chain.setHeading({ level: 1 }).run();- return;- }-- if (value === "heading-2") {- chain.setHeading({ level: 2 }).run();- return;- }-- if (value === "heading-3") {- chain.setHeading({ level: 3 }).run();+ const headingLevel = parseHeadingBlockValue(value);+ if (headingLevel) {+ chain.setHeading({ level: headingLevel }).run();}});};@@ -433,9 +426,11 @@ export const EditorToolbar = ({</SelectTrigger><SelectContent className="bg-card border border-slate-200 rounded-md py-1 shadow-md"><SelectItem value="paragraph">{t("editorToolbar.paragraph")}</SelectItem>- <SelectItem value="heading-1">{t("editorToolbar.heading1")}</SelectItem>- <SelectItem value="heading-2">{t("editorToolbar.heading2")}</SelectItem>- <SelectItem value="heading-3">{t("editorToolbar.heading3")}</SelectItem>+ {EDITOR_HEADING_LEVELS.map((level) => (+ <SelectItem key={level} value={`heading-${level}`}>+ {t(`editorToolbar.heading${level}`)}+ </SelectItem>+ ))}</SelectContent></Select>diff --git a/apps/web/src/components/editor/SlashCommandMenu.test.mjs b/apps/web/src/components/editor/SlashCommandMenu.test.mjsindex bb0d692d..94ba675c 100644--- a/apps/web/src/components/editor/SlashCommandMenu.test.mjs+++ b/apps/web/src/components/editor/SlashCommandMenu.test.mjs@@ -18,6 +18,9 @@ const labels = {"heading-1": "标题 1","heading-2": "标题 2","heading-3": "标题 3",+ "heading-4": "标题 4",+ "heading-5": "标题 5",+ "heading-6": "标题 6","bullet-list": "无序列表","ordered-list": "有序列表","task-list": "任务清单",@@ -39,10 +42,10 @@ describe("slash command menu", () => {test("shows all commands for a bare slash", () => {const unfilteredItems = filterSlashCommandItems(items, "");- const heading3Index = unfilteredItems.findIndex((item) => item.id === "heading-3");+ const heading6Index = unfilteredItems.findIndex((item) => item.id === "heading-6");- expect(unfilteredItems).toHaveLength(18);- expect(unfilteredItems.slice(heading3Index + 1, heading3Index + 4).map((item) => item.id)).toEqual([+ expect(unfilteredItems).toHaveLength(21);+ expect(unfilteredItems.slice(heading6Index + 1, heading6Index + 4).map((item) => item.id)).toEqual(["current-date","current-time","current-date-time",@@ -53,6 +56,7 @@ describe("slash command menu", () => {expect(filterSlashCommandItems(items, "AI").map((item) => item.id)).toEqual(["ai"]);expect(filterSlashCommandItems(items, "待办").map((item) => item.id)).toEqual(["task-list"]);expect(filterSlashCommandItems(items, "h2").map((item) => item.id)).toEqual(["heading-2"]);+ expect(filterSlashCommandItems(items, "h5").map((item) => item.id)).toEqual(["heading-5"]);expect(filterSlashCommandItems(items, "今天").map((item) => item.id)).toEqual(["current-date"]);expect(filterSlashCommandItems(items, "timestamp").map((item) => item.id)).toEqual(["current-date-time"]);});@@ -64,6 +68,9 @@ describe("slash command menu", () => {"h1","h2","h3",+ "h4",+ "h5",+ "h6","date","time","datetime",diff --git a/apps/web/src/components/editor/SlashCommandMenu.tsx b/apps/web/src/components/editor/SlashCommandMenu.tsxindex 3d939b48..77cd98ad 100644--- a/apps/web/src/components/editor/SlashCommandMenu.tsx+++ b/apps/web/src/components/editor/SlashCommandMenu.tsx@@ -14,6 +14,9 @@ import {Heading1,Heading2,Heading3,+ Heading4,+ Heading5,+ Heading6,Link,List,ListOrdered,@@ -38,6 +41,9 @@ export type SlashCommandId =| "heading-1"| "heading-2"| "heading-3"+ | "heading-4"+ | "heading-5"+ | "heading-6"| "bullet-list"| "ordered-list"| "task-list"@@ -98,6 +104,9 @@ export const createSlashCommandItems = (labels: SlashCommandLabels): SlashComman{ id: "heading-1", command: "h1", group: "basic", icon: Heading1, label: labels.items["heading-1"], keywords: ["heading", "标题"] },{ id: "heading-2", command: "h2", group: "basic", icon: Heading2, label: labels.items["heading-2"], keywords: ["heading", "标题"] },{ id: "heading-3", command: "h3", group: "basic", icon: Heading3, label: labels.items["heading-3"], keywords: ["heading", "标题"] },+ { id: "heading-4", command: "h4", group: "basic", icon: Heading4, label: labels.items["heading-4"], keywords: ["heading", "标题"] },+ { id: "heading-5", command: "h5", group: "basic", icon: Heading5, label: labels.items["heading-5"], keywords: ["heading", "标题"] },+ { id: "heading-6", command: "h6", group: "basic", icon: Heading6, label: labels.items["heading-6"], keywords: ["heading", "标题"] },{ id: "current-date", command: "date", group: "basic", icon: CalendarDays, label: labels.items["current-date"], keywords: ["today", "日期", "今天"] },{ id: "current-time", command: "time", group: "basic", icon: Clock3, label: labels.items["current-time"], keywords: ["now", "时间", "现在"] },{ id: "current-date-time", command: "datetime", group: "basic", icon: CalendarClock, label: labels.items["current-date-time"], keywords: ["timestamp", "日期时间", "时间戳"] },@@ -225,6 +234,9 @@ const runSlashCommand = ({case "heading-1": chain.setHeading({ level: 1 }).run(); break;case "heading-2": chain.setHeading({ level: 2 }).run(); break;case "heading-3": chain.setHeading({ level: 3 }).run(); break;+ case "heading-4": chain.setHeading({ level: 4 }).run(); break;+ case "heading-5": chain.setHeading({ level: 5 }).run(); break;+ case "heading-6": chain.setHeading({ level: 6 }).run(); break;case "bullet-list": chain.toggleBulletList().run(); break;case "ordered-list": chain.toggleOrderedList().run(); break;case "task-list": chain.toggleTaskList().run(); break;diff --git a/apps/web/src/lib/app-helpers.test.mjs b/apps/web/src/lib/app-helpers.test.mjsindex f31619f0..fb7ed217 100644--- a/apps/web/src/lib/app-helpers.test.mjs+++ b/apps/web/src/lib/app-helpers.test.mjs@@ -35,6 +35,8 @@ import {writeEditorPhonePreviewFollowPreference,resolveSelectionMoveTargetNotebookId,getMemoIdsNeedingMove,+ getActiveBlockValue,+ parseHeadingBlockValue,} from "./app-helpers.ts";const originalWindow = globalThis.window;@@ -512,3 +514,32 @@ describe("selection move target", () => {expect(getMemoIdsNeedingMove(memos, ["memo-1"], "")).toEqual([]);});});++describe("editor heading block value", () => {+ test("parses heading-1 through heading-6 and rejects other values", () => {+ expect(parseHeadingBlockValue("heading-1")).toBe(1);+ expect(parseHeadingBlockValue("heading-6")).toBe(6);+ expect(parseHeadingBlockValue("heading-7")).toBe(null);+ expect(parseHeadingBlockValue("paragraph")).toBe(null);+ });++ test("reports the active heading level including 4 through 6", () => {+ const editor = {+ isDestroyed: false,+ extensionManager: {},+ isActive: (name, attrs) => name === "heading" && attrs.level === 5,+ };++ expect(getActiveBlockValue(editor)).toBe("heading-5");+ expect(getActiveBlockValue({+ isDestroyed: false,+ extensionManager: {},+ isActive: (name, attrs) => name === "heading" && attrs.level === 3,+ })).toBe("heading-3");+ expect(getActiveBlockValue({+ isDestroyed: false,+ extensionManager: {},+ isActive: () => false,+ })).toBe("paragraph");+ });+});diff --git a/apps/web/src/lib/app-helpers.ts b/apps/web/src/lib/app-helpers.tsindex 8de75328..cf967fb8 100644--- a/apps/web/src/lib/app-helpers.ts+++ b/apps/web/src/lib/app-helpers.ts@@ -291,20 +291,26 @@ export const getEditableMemoTitle = (title: string | null | undefined) =>export const getMemoTitle = (title: string | null | undefined) => title?.trim() || DEFAULT_MEMO_TITLE;+export const EDITOR_HEADING_LEVELS = [1, 2, 3, 4, 5, 6] as const;+export type EditorHeadingLevel = (typeof EDITOR_HEADING_LEVELS)[number];++export const headingBlockValue = (level: EditorHeadingLevel) => `heading-${level}` as const;++export const parseHeadingBlockValue = (value: string): EditorHeadingLevel | null => {+ const match = /^heading-([1-6])$/.exec(value);+ return match ? Number(match[1]) as EditorHeadingLevel : null;+};+export const getActiveBlockValue = (editor: any): string => {if (!editor || editor.isDestroyed || !editor.extensionManager) {return "paragraph";}try {- if (editor.isActive("heading", { level: 1 })) {- return "heading-1";- }- if (editor.isActive("heading", { level: 2 })) {- return "heading-2";- }- if (editor.isActive("heading", { level: 3 })) {- return "heading-3";+ for (const level of EDITOR_HEADING_LEVELS) {+ if (editor.isActive("heading", { level })) {+ return headingBlockValue(level);+ }}} catch {return "paragraph";diff --git a/apps/web/src/lib/publish-layout.test.mjs b/apps/web/src/lib/publish-layout.test.mjsindex 3926867a..1b9abcf9 100644--- a/apps/web/src/lib/publish-layout.test.mjs+++ b/apps/web/src/lib/publish-layout.test.mjs@@ -92,6 +92,8 @@ describe("publish layout catalog", () => {expect(planHeadingDecoration("h2", "stub", 0)).toEqual({ kind: "chapter", chapterLabel: "01" });expect(planHeadingDecoration("h2", "grove", 0)).toEqual({ kind: "none" });expect(planHeadingDecoration("h1", "letter", 0)).toEqual({ kind: "title" });+ expect(planHeadingDecoration("h4", "letter", 0)).toEqual({ kind: "none" });+ expect(planHeadingDecoration("h6", "guide", 0)).toEqual({ kind: "none" });expect(PUBLISH_LAYOUT_CHROME.letter.chapter).toBe("aside-serif");expect(PUBLISH_LAYOUT_CHROME.letter.quote).toBe("grid-card");expect(PUBLISH_LAYOUT_CHROME.brief.quoteBanner).toBe("EDITOR'S NOTE");@@ -110,6 +112,8 @@ describe("publish layout CSS", () => {expect(phone.p).toContain("margin: 0 0 28px");expect(phone.h1).toContain("font-size: 24px");expect(phone.h2).toContain("font-size: 20px");+ expect(phone.h4).toContain("font-size: 14px");+ expect(phone.h6).toContain("font-size: 13px");expect(desktop.p).toContain("font-size: 15px");expect(desktop.p).toContain("line-height: 2");});diff --git a/apps/web/src/lib/publish-layout.ts b/apps/web/src/lib/publish-layout.tsindex cc6eb2e3..847db364 100644--- a/apps/web/src/lib/publish-layout.ts+++ b/apps/web/src/lib/publish-layout.ts@@ -506,6 +506,9 @@ export const PHONE_ARTICLE_RHYTHM = {h1Size: "24px",h2Size: "20px",h3Size: "15px",+ h4Size: "14px",+ h5Size: "13px",+ h6Size: "13px",} as const;const resolvePublishRhythm = (layout: PublishLayoutId, _surface: PublishSurface): PublishRhythm =>@@ -832,6 +835,30 @@ export const buildPublishStyles = (color: chrome.small === "slash" ? palette.accent : palette.textStrong,...h3Rules,}),+ h4: css({+ margin: phone ? "12px 0 6px" : "20px 0 10px",+ "font-size": phone ? PHONE_ARTICLE_RHYTHM.h4Size : "14px",+ "line-height": "1.5",+ "letter-spacing": rhythm.headingLetterSpacing,+ "font-weight": "700",+ color: palette.textStrong,+ }),+ h5: css({+ margin: phone ? "10px 0 6px" : "16px 0 8px",+ "font-size": phone ? PHONE_ARTICLE_RHYTHM.h5Size : "13px",+ "line-height": "1.5",+ "letter-spacing": rhythm.headingLetterSpacing,+ "font-weight": "700",+ color: palette.textStrong,+ }),+ h6: css({+ margin: phone ? "10px 0 6px" : "14px 0 8px",+ "font-size": phone ? PHONE_ARTICLE_RHYTHM.h6Size : "13px",+ "line-height": "1.5",+ "letter-spacing": rhythm.headingLetterSpacing,+ "font-weight": "700",+ color: palette.textMuted,+ }),blockquote: css({"line-height": rhythm.lineHeight,"letter-spacing": rhythm.letterSpacing,@@ -1481,7 +1508,7 @@ const decorateHeadings = () => {const chrome = PUBLISH_LAYOUT_CHROME[layout];const phone = surface === "phone";- const headings = Array.from(root.querySelectorAll<HTMLElement>("h1, h2, h3")).filter((heading) => {+ const headings = Array.from(root.querySelectorAll<HTMLElement>("h1, h2, h3, h4, h5, h6")).filter((heading) => {if (heading.closest("table, pre, [data-edgeever-theme-block]")) return false;if (heading.closest("[data-ee-publish-heading]")) return false;return true;diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.tsindex 48d4ef6d..7bd9af02 100644--- a/apps/web/src/lib/wechat-copy.ts+++ b/apps/web/src/lib/wechat-copy.ts@@ -15,6 +15,9 @@ const WECHAT_STYLES: Record<string, string> = {h1: "margin: 1.2em 0 0.6em; font-size: 24px; line-height: 1.35; font-weight: 700; color: #1f2937;",h2: "margin: 1.1em 0 0.55em; font-size: 21px; line-height: 1.4; font-weight: 700; color: #1f2937;",h3: "margin: 1em 0 0.5em; font-size: 18px; line-height: 1.45; font-weight: 700; color: #1f2937;",+ h4: "margin: 0.95em 0 0.45em; font-size: 16px; line-height: 1.5; font-weight: 700; color: #1f2937;",+ h5: "margin: 0.9em 0 0.4em; font-size: 15px; line-height: 1.5; font-weight: 700; color: #1f2937;",+ h6: "margin: 0.85em 0 0.35em; font-size: 14px; line-height: 1.5; font-weight: 700; color: #1f2937;",blockquote: `margin: 1em 0; padding: 0.6em 1em; border-left: 4px solid #10b981; background: #f0fdf4; color: #4b5563; line-height: ${BODY_LINE_HEIGHT};`,ul: `margin: 0 0 1em; padding-left: 1.6em; line-height: ${BODY_LINE_HEIGHT};`,ol: `margin: 0 0 1em; padding-left: 1.6em; line-height: ${BODY_LINE_HEIGHT};`,@@ -56,7 +59,7 @@ const applyLegacyWeChatStyles = (} else if (customColors) {if (tagName === "p") {style = `margin: 0 0 ${PARAGRAPH_SPACING}; padding: 0; line-height: ${BODY_LINE_HEIGHT}; font-size: ${BODY_FONT_SIZE}; color: ${textColor};`;- } else if (tagName === "h1" || tagName === "h2" || tagName === "h3") {+ } else if (tagName === "h1" || tagName === "h2" || tagName === "h3" || tagName === "h4" || tagName === "h5" || tagName === "h6") {style = style.replace("color: #1f2937;", `color: ${textColor};`);} else if (tagName === "blockquote") {style = `margin: 1em 0; padding: 0.6em 1em; border-left: 4px solid ${accent}; background: ${soft}; color: ${textColor}; line-height: ${BODY_LINE_HEIGHT};`;diff --git a/apps/web/src/styles/editor-themes/base.css b/apps/web/src/styles/editor-themes/base.cssindex d668f170..a033dc6f 100644--- a/apps/web/src/styles/editor-themes/base.css+++ b/apps/web/src/styles/editor-themes/base.css@@ -47,7 +47,10 @@.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h2,-.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h3 {+.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h3,+.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-editor-theme]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--editor-theme-heading, var(--editor-theme-text));}diff --git a/apps/web/src/styles/editor-themes/minimal-emerald.css b/apps/web/src/styles/editor-themes/minimal-emerald.cssindex 0b72ec2e..a640fbdd 100644--- a/apps/web/src/styles/editor-themes/minimal-emerald.css+++ b/apps/web/src/styles/editor-themes/minimal-emerald.css@@ -37,7 +37,9 @@.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h2,.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h3,-.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4 {+.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--editor-theme-heading);font-family: var(--editor-theme-font);font-weight: 600;@@ -68,6 +70,21 @@padding-left: 0;}+.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4 {+ font-size: 1.05rem;+ margin: 1.25rem 0 0.55rem;+}++.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h5 {+ font-size: 1rem;+ margin: 1.1rem 0 0.45rem;+}++.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror h6 {+ font-size: 0.95rem;+ margin: 1rem 0 0.4rem;+}+.edgeever-editor[data-editor-theme="minimal-emerald"]:not([data-editor-theme="default"]) .ProseMirror strong {color: var(--editor-theme-heading);font-weight: 700;diff --git a/apps/web/src/styles/editor-themes/modern-mint.css b/apps/web/src/styles/editor-themes/modern-mint.cssindex f7d171ca..6404ba7b 100644--- a/apps/web/src/styles/editor-themes/modern-mint.css+++ b/apps/web/src/styles/editor-themes/modern-mint.css@@ -37,7 +37,9 @@.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h2,.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h3,-.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h4 {+.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--editor-theme-heading);font-family: var(--editor-theme-font);margin: 1.8rem 0 0.8rem;@@ -69,6 +71,24 @@padding-left: 0;}+.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h4 {+ font-size: 1.05rem;+ font-weight: 600;+ margin: 1.4rem 0 0.6rem;+}++.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h5 {+ font-size: 1rem;+ font-weight: 600;+ margin: 1.25rem 0 0.5rem;+}++.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror h6 {+ font-size: 0.95rem;+ font-weight: 600;+ margin: 1.1rem 0 0.45rem;+}+.edgeever-editor[data-editor-theme="modern-mint"]:not([data-editor-theme="default"]) .ProseMirror strong {color: var(--editor-theme-heading);font-weight: 700;diff --git a/apps/web/src/styles/editor-themes/outline-emerald.css b/apps/web/src/styles/editor-themes/outline-emerald.cssindex 76892cfa..a16d7c53 100644--- a/apps/web/src/styles/editor-themes/outline-emerald.css+++ b/apps/web/src/styles/editor-themes/outline-emerald.css@@ -37,7 +37,9 @@.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h2,.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h3,-.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4 {+.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--editor-theme-heading);font-family: var(--editor-theme-font);font-weight: 600;@@ -70,6 +72,21 @@padding-left: 0;}+.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h4 {+ font-size: 1.05rem;+ margin: 1.3rem 0 0.5rem;+}++.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h5 {+ font-size: 1rem;+ margin: 1.15rem 0 0.45rem;+}++.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror h6 {+ font-size: 0.95rem;+ margin: 1rem 0 0.4rem;+}+.edgeever-editor[data-editor-theme="outline-emerald"]:not([data-editor-theme="default"]) .ProseMirror strong {color: var(--editor-theme-heading);font-weight: 700;diff --git a/apps/web/src/styles/editor-themes/wechat-green.css b/apps/web/src/styles/editor-themes/wechat-green.cssindex 8029e43a..335924e4 100644--- a/apps/web/src/styles/editor-themes/wechat-green.css+++ b/apps/web/src/styles/editor-themes/wechat-green.css@@ -37,7 +37,9 @@.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h2,.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h3,-.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h4 {+.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--editor-theme-heading);font-family: var(--editor-theme-font);margin: 1.8rem 0 0.8rem;@@ -69,6 +71,24 @@padding-left: 0;}+.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h4 {+ font-size: 1.05rem;+ font-weight: 600;+ margin: 1.4rem 0 0.6rem;+}++.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h5 {+ font-size: 1rem;+ font-weight: 600;+ margin: 1.25rem 0 0.5rem;+}++.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror h6 {+ font-size: 0.95rem;+ font-weight: 600;+ margin: 1.1rem 0 0.45rem;+}+.edgeever-editor[data-editor-theme="wechat-green"]:not([data-editor-theme="default"]) .ProseMirror strong {color: var(--editor-theme-accent);background: rgba(7, 193, 96, 0.08);diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.cssindex a55d1646..2b8c9de9 100644--- a/apps/web/src/styles/globals.css+++ b/apps/web/src/styles/globals.css@@ -667,7 +667,10 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {:root.dark .ProseMirror,:root.dark .ProseMirror h1,:root.dark .ProseMirror h2,-:root.dark .ProseMirror h3 {+:root.dark .ProseMirror h3,+:root.dark .ProseMirror h4,+:root.dark .ProseMirror h5,+:root.dark .ProseMirror h6 {color: hsl(var(--foreground));}@@ -947,6 +950,31 @@ textarea {color: #1e293b;}+.ProseMirror h4 {+ font-size: 1.0625rem;+ font-weight: 600;+ line-height: 1.4;+ letter-spacing: -0.006em;+ margin: 1.05rem 0 0.45rem;+ color: #1e293b;+}++.ProseMirror h5 {+ font-size: 1rem;+ font-weight: 600;+ line-height: 1.42;+ margin: 0.95rem 0 0.4rem;+ color: #334155;+}++.ProseMirror h6 {+ font-size: 0.9375rem;+ font-weight: 600;+ line-height: 1.45;+ margin: 0.85rem 0 0.35rem;+ color: #334155;+}+.ProseMirror p {line-height: var(--editor-body-line-height);margin: 0 0 var(--editor-paragraph-spacing);@@ -1874,7 +1902,9 @@ textarea {.companion-markdown.markdown-content h1,.companion-markdown.markdown-content h2,.companion-markdown.markdown-content h3,-.companion-markdown.markdown-content h4 {+.companion-markdown.markdown-content h4,+.companion-markdown.markdown-content h5,+.companion-markdown.markdown-content h6 {font-size: 0.8125rem;font-weight: 600;line-height: 1.4;@@ -1886,7 +1916,9 @@ textarea {.companion-markdown.markdown-content h1:first-child,.companion-markdown.markdown-content h2:first-child,.companion-markdown.markdown-content h3:first-child,-.companion-markdown.markdown-content h4:first-child {+.companion-markdown.markdown-content h4:first-child,+.companion-markdown.markdown-content h5:first-child,+.companion-markdown.markdown-content h6:first-child {margin-top: 0;}.companion-markdown.markdown-content p {diff --git a/apps/web/src/styles/note-html-export.css b/apps/web/src/styles/note-html-export.cssindex b7897532..cb9b6108 100644--- a/apps/web/src/styles/note-html-export.css+++ b/apps/web/src/styles/note-html-export.css@@ -53,7 +53,10 @@ body {.edgeever-html-content h1,.edgeever-html-content h2,-.edgeever-html-content h3 {+.edgeever-html-content h3,+.edgeever-html-content h4,+.edgeever-html-content h5,+.edgeever-html-content h6 {color: #0f172a;line-height: 1.25;}@@ -73,6 +76,21 @@ body {font-size: 1.15rem;}+.edgeever-html-content h4 {+ margin: 1.15rem 0 0.5rem;+ font-size: 1.05rem;+}++.edgeever-html-content h5 {+ margin: 1.05rem 0 0.45rem;+ font-size: 1rem;+}++.edgeever-html-content h6 {+ margin: 0.95rem 0 0.4rem;+ font-size: 0.95rem;+}+.edgeever-html-content p {margin: 0 0 0.9rem;}diff --git a/apps/web/src/styles/publish-layout.css b/apps/web/src/styles/publish-layout.cssindex 4cb6f7e3..0f7d6492 100644--- a/apps/web/src/styles/publish-layout.css+++ b/apps/web/src/styles/publish-layout.css@@ -39,7 +39,10 @@.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h1,.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h2,-.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h3 {+.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h3,+.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h4,+.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h5,+.edgeever-editor[data-paper-theme]:not([data-editor-theme="default"]) .ProseMirror h6 {color: var(--publish-text-strong);border: 0;padding-left: 0;@@ -622,6 +625,17 @@margin: 0.9rem 0 0.5rem;}+.edgeever-editor[data-publish-surface="phone"][data-paper-theme] .ProseMirror h4 {+ font-size: 0.875rem;+ margin: 0.8rem 0 0.45rem;+}++.edgeever-editor[data-publish-surface="phone"][data-paper-theme] .ProseMirror h5,+.edgeever-editor[data-publish-surface="phone"][data-paper-theme] .ProseMirror h6 {+ font-size: 0.8125rem;+ margin: 0.7rem 0 0.4rem;+}+.edgeever-editor[data-publish-surface="phone"][data-paper-theme] .ProseMirror blockquote {margin-bottom: 0.9rem;padding: 0.65rem 0.75rem;diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 8d62c746..b1bbe670 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -1917,6 +1917,9 @@ export const enUS = {heading1: "Heading 1",heading2: "Heading 2",heading3: "Heading 3",+ heading4: "Heading 4",+ heading5: "Heading 5",+ heading6: "Heading 6",undo: "Undo",redo: "Redo",bold: "Bold",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex 87e90bef..3c2d42de 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -1917,6 +1917,9 @@ export const ja = {heading1: "見出し 1",heading2: "見出し 2",heading3: "見出し 3",+ heading4: "見出し 4",+ heading5: "見出し 5",+ heading6: "見出し 6",undo: "元に戻す",redo: "やり直す",bold: "太字",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex e41a4c3d..aef32bb8 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -1915,6 +1915,9 @@ export const zhCN = {heading1: "标题 1",heading2: "标题 2",heading3: "标题 3",+ heading4: "标题 4",+ heading5: "标题 5",+ heading6: "标题 6",undo: "撤销",redo: "重做",bold: "加粗",diff --git a/packages/shared/src/note-image-card.ts b/packages/shared/src/note-image-card.tsindex a0af5c9c..5f330f12 100644--- a/packages/shared/src/note-image-card.ts+++ b/packages/shared/src/note-image-card.ts@@ -265,6 +265,9 @@ export const NOTE_IMAGE_FONT_SIZES: Record<h1: string;h2: string;h3: string;+ h4: string;+ h5: string;+ h6: string;meta: string;code: string;}@@ -276,6 +279,9 @@ export const NOTE_IMAGE_FONT_SIZES: Record<h1: "21px",h2: "18px",h3: "16px",+ h4: "15px",+ h5: "14.5px",+ h6: "14.5px",meta: "12px",code: "12.5px",},@@ -286,6 +292,9 @@ export const NOTE_IMAGE_FONT_SIZES: Record<h1: "24px",h2: "20px",h3: "17.5px",+ h4: "16.5px",+ h5: "16px",+ h6: "16px",meta: "13px",code: "13.5px",},@@ -296,6 +305,9 @@ export const NOTE_IMAGE_FONT_SIZES: Record<h1: "27px",h2: "22.5px",h3: "19px",+ h4: "18px",+ h5: "18px",+ h6: "18px",meta: "14px",code: "15px",},@@ -477,6 +489,9 @@ export const generateCardCss = ({--ee-h1-size: ${sizeCfg.h1};--ee-h2-size: ${sizeCfg.h2};--ee-h3-size: ${sizeCfg.h3};+ --ee-h4-size: ${sizeCfg.h4};+ --ee-h5-size: ${sizeCfg.h5};+ --ee-h6-size: ${sizeCfg.h6};--ee-meta-size: ${sizeCfg.meta};--ee-code-size: ${sizeCfg.code};}@@ -592,7 +607,10 @@ export const generateCardCss = ({.edgeever-card-body h1,.edgeever-card-body h2,- .edgeever-card-body h3 {+ .edgeever-card-body h3,+ .edgeever-card-body h4,+ .edgeever-card-body h5,+ .edgeever-card-body h6 {color: var(--ee-heading-color);line-height: 1.28;font-weight: 720;@@ -607,6 +625,9 @@ export const generateCardCss = ({}.edgeever-card-body h2 { font-size: var(--ee-h2-size); margin: 1.4em 0 0.6em; }.edgeever-card-body h3 { font-size: var(--ee-h3-size); margin: 1.2em 0 0.5em; }+ .edgeever-card-body h4 { font-size: var(--ee-h4-size); margin: 1.1em 0 0.45em; }+ .edgeever-card-body h5 { font-size: var(--ee-h5-size); margin: 1em 0 0.4em; }+ .edgeever-card-body h6 { font-size: var(--ee-h6-size); margin: 0.9em 0 0.35em; }.edgeever-card-body p { margin: 0 0 1em; }diff --git a/tests/content-markdown.test.ts b/tests/content-markdown.test.tsindex f9f0261a..3f9e0a9e 100644--- a/tests/content-markdown.test.ts+++ b/tests/content-markdown.test.ts@@ -36,6 +36,31 @@ describe("shared Markdown conversion", () => {});});+ test("preserves heading levels 1 through 6", () => {+ const markdown = `# H1++## H2++### H3++#### H4++##### H5++###### H6`;++ const doc = markdownToDoc(markdown);+ expect(doc.content.map((node) => [node.type, node.attrs?.level])).toEqual([+ ["heading", 1],+ ["heading", 2],+ ["heading", 3],+ ["heading", 4],+ ["heading", 5],+ ["heading", 6],+ ]);+ expect(docToMarkdown(doc)).toBe(markdown);+ });+test("serializes TipTap marks and block nodes back to Markdown", () => {const markdown = `# 标题