Skip to content

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

feat(web): add emerald prose palette and composable reading styles

tianma-ife0161ffa4c4c
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index d68f0d45..7af1344c 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -56,6 +56,7 @@ import {
import { EditorToolbar } from "./EditorToolbar";
import { EditorOutline } from "./EditorOutline";
import { SelectionAiActions } from "./editor/SelectionAiActions";
+import { EditorMagazineHeader } from "./editor/EditorMagazineHeader";
import { useAiBubbleMenu } from "./editor/useAiBubbleMenu";
import {
createEditorInstanceMemoIdentity,
@@ -172,6 +173,7 @@ import {
getMemoSaveConflictInfoFromQueueItem,
} from "@/lib/memo-save-conflict";
import { copyResourceToClipboard, copyTextToClipboard } from "@/lib/clipboard";
+import { useNoteProseStylePreference } from "@/lib/note-prose-style-preference";
import { createClientUuid } from "@/lib/client-id";
import { isLocalMemoId, remapLocalDraftMemoId } from "@/lib/local-mirror";
import { shouldAcceptRemoteMemoDetail } from "@/lib/memo-detail-freshness";
@@ -701,6 +703,7 @@ const RichEditorPane = ({
}, [desktopReadingProtection, setAiSidebarOpen]);
const memoRef = useRef<MemoDetail | null>(memo);
+ const noteProseStyle = useNoteProseStylePreference();
const editSessionRef = useRef<MemoEditSession | null>(null);
const editorRef = useRef<Editor | null>(null);
const headingShortcutSurfaceRef = useRef({ markdown: false, plainText: false });
@@ -4508,6 +4511,10 @@ const RichEditorPane = ({
ref={setEditorScrollContainerRef}
data-editor-theme="default"
data-note-palette={noteProse.palette}
+ data-note-heading-style={noteProseStyle.headingStyle}
+ data-note-quote-style={noteProseStyle.quoteStyle}
+ data-note-emphasis-style={noteProseStyle.emphasisStyle}
+ data-note-title={title || getEditableMemoTitle(memo?.title)}
style={{
...noteProseCssVariables(noteProse),
"--memo-content-divider-spacing": `${MEMO_CONTENT_STYLE.divider.marginVertical}px`,
@@ -4667,6 +4674,15 @@ const RichEditorPane = ({
onAsk={() => requestSelectionAi("ask")}
/>
</BubbleMenu>
+ {noteProseStyle.headingStyle === "numbered" ? (
+ <EditorMagazineHeader
+ editor={editor}
+ title={title || getEditableMemoTitle(memo?.title)}
+ tags={memo?.tags}
+ updatedAt={memo?.updatedAt}
+ palette={noteProse.palette}
+ />
+ ) : null}
<EditorTableContextMenu editor={editor} readOnly={effectiveReadOnly}>
<AttachmentTranscriptContext.Provider value={attachmentTranscriptContext}>
<EditorContent editor={editor} />
diff --git a/apps/web/src/components/EditorPhonePreview.tsx b/apps/web/src/components/EditorPhonePreview.tsx
index ceb79211..7b35ea1e 100644
--- a/apps/web/src/components/EditorPhonePreview.tsx
+++ b/apps/web/src/components/EditorPhonePreview.tsx
@@ -7,6 +7,7 @@ import { useMermaidTheme } from "@/components/ThemeProvider";
import { embedMermaidForPreview } from "@/lib/phone-preview-mermaid";
import { Switch } from "@/components/ui/switch";
import { preparePublishArticle } from "@/lib/wechat-copy";
+import { useNoteProseStylePreference } from "@/lib/note-prose-style-preference";
import {
readEditorPhonePreviewFollowPreference,
writeEditorPhonePreviewFollowPreference,
@@ -66,7 +67,8 @@ const alignElement = (scroller: HTMLElement, target: HTMLElement, viewportTop: n
export const EditorPhonePreview = ({ editor, title, noteProse, scrollContainer, className }: EditorPhonePreviewProps) => {
const { t } = useTranslation();
const { mermaidTheme } = useMermaidTheme();
- const proseKey = `${noteProse.palette}:${noteProse.fontSize}:${noteProse.lineHeight}:${noteProse.customCss}`;
+ const noteProseStyle = useNoteProseStylePreference();
+ const proseKey = `${noteProse.palette}:${noteProse.fontSize}:${noteProse.lineHeight}:${noteProse.customCss}:${noteProseStyle.headingStyle}:${noteProseStyle.quoteStyle}:${noteProseStyle.emphasisStyle}`;
const previewSyncGeneration = useRef(0);
const [markup, setMarkup] = useState({ html: "", style: "" });
const [follow, setFollow] = useState(readEditorPhonePreviewFollowPreference);
@@ -103,7 +105,7 @@ export const EditorPhonePreview = ({ editor, title, noteProse, scrollContainer,
editor.off("update", sync);
editor.off("create", sync);
};
- }, [editor, mermaidTheme, noteProse]);
+ }, [editor, mermaidTheme, noteProse, noteProseStyle, title]);
useEffect(() => {
previewRef.current?.setAttribute("style", markup.style);
@@ -209,7 +211,9 @@ export const EditorPhonePreview = ({ editor, title, noteProse, scrollContainer,
<span className="edgeever-phone-device__lens" />
</div>
<div className="edgeever-phone-preview" ref={previewRef}>
- {title?.trim() ? <p className="edgeever-phone-shell-title">{title.trim()}</p> : null}
+ {title?.trim() && noteProseStyle.headingStyle !== "numbered" ? (
+ <p className="edgeever-phone-shell-title">{title.trim()}</p>
+ ) : null}
{markup.html ? (
<div
key={proseKey}
diff --git a/apps/web/src/components/editor/EditorMagazineHeader.tsx b/apps/web/src/components/editor/EditorMagazineHeader.tsx
new file mode 100644
index 00000000..e31108c2
--- /dev/null
+++ b/apps/web/src/components/editor/EditorMagazineHeader.tsx
@@ -0,0 +1,395 @@
+import { useEffect, useState } from "react";
+import type { Editor } from "@tiptap/react";
+
+type SectionItem = {
+ index: number;
+ num: string;
+ shortTitle: string;
+ subTitle: string;
+};
+
+const cleanHeadingText = (raw: string) =>
+ raw
+ .replace(/^\s*(?:第[一二三四五六七八九十百\d]+[章节部分篇]\s*[::·.\s]*|\d+\s*[.、·::]\s*|[一二三四五六七八九十]+\s*[、..]\s*)/u, "")
+ .trim();
+
+const deriveShortAndSubTitle = (raw: string, index: number) => {
+ const cleaned = cleanHeadingText(raw) || raw.trim() || `章节 ${index + 1}`;
+ const parts = cleaned.split(/[::,,——·\s]+/).filter(Boolean);
+ if (parts.length >= 2 && parts[0].length <= 8) {
+ return {
+ shortTitle: parts[0],
+ subTitle: parts.slice(1).join(" · ").slice(0, 14),
+ };
+ }
+ if (cleaned.length <= 6) {
+ return {
+ shortTitle: cleaned,
+ subTitle: `PART ${String(index + 1).padStart(2, "0")}`,
+ };
+ }
+ return {
+ shortTitle: cleaned.slice(0, 5),
+ subTitle: cleaned.slice(5, 17) || cleaned.slice(0, 12),
+ };
+};
+
+const splitCoverTitle = (rawTitle: string) => {
+ const trimmed = rawTitle.trim();
+ if (!trimmed) {
+ return { primary: "深度实测与结构化指南", highlight: "" };
+ }
+ const colonMatch = trimmed.match(/^([^::,,——]+)[::,,——]\s*(.+)$/);
+ if (colonMatch) {
+ return {
+ primary: `${colonMatch[1]},`,
+ highlight: colonMatch[2],
+ };
+ }
+ if (trimmed.length > 10) {
+ const mid = Math.ceil(trimmed.length * 0.45);
+ return {
+ primary: trimmed.slice(0, mid),
+ highlight: trimmed.slice(mid),
+ };
+ }
+ return { primary: trimmed, highlight: "" };
+};
+
+const formatYearMonth = (iso?: string) => {
+ const date = iso ? new Date(iso) : new Date();
+ if (Number.isNaN(date.getTime())) return "2026.11";
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ return `${year}.${month}`;
+};
+
+export const EditorMagazineHeader = ({
+ editor,
+ title,
+ tags = [],
+ notebookName,
+ updatedAt,
+ palette = "native",
+}: {
+ editor: Editor | null;
+ title?: string;
+ tags?: string[];
+ notebookName?: string;
+ updatedAt?: string;
+ palette?: string;
+}) => {
+ const isNative = !palette || palette === "native";
+ const [sections, setSections] = useState<SectionItem[]>([]);
+ const [leadSummary, setLeadSummary] = useState("");
+
+ useEffect(() => {
+ if (!editor || editor.isDestroyed) {
+ setSections([]);
+ setLeadSummary("");
+ return;
+ }
+
+ const sync = () => {
+ if (editor.isDestroyed) return;
+ const dom = editor.view.dom;
+ const h2Elements = Array.from(dom.querySelectorAll<HTMLElement>("h2"));
+ const nextSections = h2Elements.map((el, index) => {
+ const { shortTitle, subTitle } = deriveShortAndSubTitle(el.textContent || "", index);
+ return {
+ index,
+ num: String(index + 1).padStart(2, "0"),
+ shortTitle,
+ subTitle,
+ };
+ });
+ setSections(nextSections);
+
+ const firstParagraph = dom.querySelector<HTMLElement>("blockquote p, p");
+ const firstText = (firstParagraph?.textContent || "").replace(/\s+/g, " ").trim();
+ setLeadSummary(firstText.slice(0, 42));
+ };
+
+ sync();
+ editor.on("update", sync);
+ editor.on("create", sync);
+ return () => {
+ editor.off("update", sync);
+ editor.off("create", sync);
+ };
+ }, [editor]);
+
+ const { primary, highlight } = splitCoverTitle(title || "");
+ const topTag = tags.length > 0
+ ? tags.slice(0, 2).map((tag) => tag.replace(/^#/, "")).join(" · ").toUpperCase()
+ : "实测 · 深度梳理";
+ const dateLabel = formatYearMonth(updatedAt);
+ const subtitleText = leadSummary
+ || (sections.length > 0
+ ? `${sections.length} 个核心章节,从全局脉络到关键细节完整拆解`
+ : "结构化核心脉络与实战要点梳理");
+
+ const scrollToSection = (index: number) => {
+ if (!editor || editor.isDestroyed) return;
+ const h2Elements = editor.view.dom.querySelectorAll<HTMLElement>("h2");
+ const target = h2Elements[index];
+ target?.scrollIntoView({ behavior: "smooth", block: "start" });
+ };
+
+ return (
+ <div
+ data-edgeever-magazine-header="true"
+ className="mb-6 select-none"
+ style={{
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif",
+ }}
+ >
+ {/* Component 2: Magazine cover-breaking card */}
+ <div
+ style={{
+ margin: "0 0 28px",
+ background: "#ffffff",
+ border: isNative
+ ? "1.5px solid #e5e7eb"
+ : "1.5px solid color-mix(in srgb, var(--note-palette-accent, #374151) 18%, transparent)",
+ borderRadius: "20px",
+ overflow: "hidden",
+ boxShadow: "0 4px 20px rgba(0, 0, 0, 0.06)",
+ }}
+ >
+ <div style={{ padding: "28px 28px 24px" }}>
+ <div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "22px" }}>
+ <span
+ style={{
+ width: "6px",
+ height: "6px",
+ borderRadius: "50%",
+ background: "var(--note-palette-accent, #4b5563)",
+ flexShrink: 0,
+ }}
+ />
+ <span
+ style={{
+ fontSize: "11px",
+ fontWeight: 700,
+ letterSpacing: "3px",
+ color: "var(--note-palette-accent, #4b5563)",
+ }}
+ >
+ {topTag}
+ </span>
+ <span
+ style={{
+ flex: 1,
+ height: "1px",
+ background: isNative
+ ? "linear-gradient(to right, #e5e7eb, transparent)"
+ : "linear-gradient(to right, color-mix(in srgb, var(--note-palette-accent, #374151) 18%, transparent), transparent)",
+ }}
+ />
+ <span style={{ fontSize: "10px", color: "#d1d5db", fontWeight: 600 }}>
+ {dateLabel}
+ </span>
+ </div>
+
+ <p
+ style={{
+ fontSize: "24px",
+ fontWeight: 900,
+ color: "#111827",
+ margin: "0 0 14px",
+ lineHeight: 1.18,
+ letterSpacing: "-1px",
+ }}
+ >
+ <span>{primary}</span>
+ {highlight ? (
+ <span style={{ color: "var(--note-palette-accent, #374151)" }}>{highlight}</span>
+ ) : null}
+ </p>
+
+ <div
+ style={{
+ width: "48px",
+ height: "3px",
+ background: isNative
+ ? "linear-gradient(to right, #4b5563, #9ca3af)"
+ : "linear-gradient(to right, var(--note-palette-accent, #374151), color-mix(in srgb, var(--note-palette-accent, #374151) 68%, #ffffff))",
+ borderRadius: "2px",
+ marginBottom: "12px",
+ }}
+ />
+
+ <p
+ style={{
+ fontSize: "13px",
+ color: "#9ca3af",
+ margin: 0,
+ lineHeight: 1.7,
+ letterSpacing: "0.5px",
+ }}
+ >
+ {subtitleText}
+ </p>
+ </div>
+
+ <div
+ style={{
+ background: isNative
+ ? "#f3f4f6"
+ : "linear-gradient(135deg, var(--note-palette-accent, #374151), color-mix(in srgb, var(--note-palette-accent, #374151) 80%, #ffffff))",
+ borderTop: isNative ? "1px solid #e5e7eb" : undefined,
+ padding: "11px 28px",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: "12px",
+ }}
+ >
+ <span
+ style={{
+ fontSize: "12px",
+ color: isNative ? "#374151" : "rgba(255, 255, 255, 0.92)",
+ fontWeight: 600,
+ letterSpacing: "0.5px",
+ }}
+ >
+ {notebookName?.trim() || "EdgeEver 专栏"}
+ </span>
+ <div style={{ display: "flex", alignItems: "center", gap: "6px" }}>
+ {sections.length > 0 ? (
+ <span
+ style={{
+ background: isNative ? "#ffffff" : "rgba(255, 255, 255, 0.2)",
+ border: isNative ? "1px solid #e5e7eb" : undefined,
+ padding: "2px 7px",
+ borderRadius: "4px",
+ fontSize: "10px",
+ color: isNative ? "#374151" : "#ffffff",
+ fontWeight: 600,
+ }}
+ >
+ {sections.length} 个章节
+ </span>
+ ) : null}
+ {tags.slice(0, 2).map((tag) => (
+ <span
+ key={tag}
+ style={{
+ background: isNative ? "#ffffff" : "rgba(255, 255, 255, 0.2)",
+ border: isNative ? "1px solid #e5e7eb" : undefined,
+ padding: "2px 7px",
+ borderRadius: "4px",
+ fontSize: "10px",
+ color: isNative ? "#374151" : "#ffffff",
+ fontWeight: 600,
+ }}
+ >
+ {tag.replace(/^#/, "")}
+ </span>
+ ))}
+ </div>
+ </div>
+ </div>
+
+ {/* Component 3: Horizontal PARTS directory cards (toc-scroll) */}
+ {sections.length >= 2 ? (
+ <div style={{ margin: "0 0 28px" }}>
+ <div
+ style={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ marginBottom: "10px",
+ }}
+ >
+ <span
+ style={{
+ fontSize: "10px",
+ color: "#9ca3af",
+ textTransform: "uppercase",
+ letterSpacing: "2px",
+ fontWeight: 600,
+ }}
+ >
+ {sections.length} PARTS · 章节导览
+ </span>
+ </div>
+ <div style={{ display: "flex", flexWrap: "wrap", gap: "8px" }}>
+ {sections.map((section, idx) => {
+ const isHighlighted = idx < sections.length - 1;
+ const useSolidAccent = isHighlighted && !isNative;
+ return (
+ <button
+ key={section.num}
+ type="button"
+ onClick={() => scrollToSection(section.index)}
+ style={
+ useSolidAccent
+ ? {
+ width: "146px",
+ textAlign: "left",
+ background: "linear-gradient(135deg, var(--note-palette-accent, #374151), color-mix(in srgb, var(--note-palette-accent, #374151) 80%, #ffffff))",
+ border: "1px solid transparent",
+ borderRadius: "12px",
+ padding: "12px",
+ cursor: "pointer",
+ }
+ : {
+ width: "146px",
+ textAlign: "left",
+ background: isHighlighted ? "#f3f4f6" : "#ffffff",
+ border: "1px solid #e5e7eb",
+ borderRadius: "12px",
+ padding: "12px",
+ boxShadow: "0 2px 6px rgba(0, 0, 0, 0.03)",
+ cursor: "pointer",
+ }
+ }
+ >
+ <div
+ style={{
+ fontSize: "9px",
+ fontWeight: 700,
+ color: useSolidAccent ? "rgba(255, 255, 255, 0.72)" : "#6b7280",
+ letterSpacing: "1px",
+ marginBottom: "5px",
+ }}
+ >
+ {section.num}
+ </div>
+ <div
+ style={{
+ fontSize: "13px",
+ fontWeight: 800,
+ color: useSolidAccent ? "#ffffff" : "#111827",
+ marginBottom: "3px",
+ lineHeight: 1.3,
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ }}
+ >
+ {section.shortTitle}
+ </div>
+ <div
+ style={{
+ fontSize: "10px",
+ color: useSolidAccent ? "rgba(255, 255, 255, 0.75)" : "#6b7280",
+ lineHeight: 1.4,
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ }}
+ >
+ {section.subTitle}
+ </div>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ ) : null}
+ </div>
+ );
+};
diff --git a/apps/web/src/components/settings/PreferenceCard.test.mjs b/apps/web/src/components/settings/PreferenceCard.test.mjs
index 5ad8a20e..bd3c8a77 100644
--- a/apps/web/src/components/settings/PreferenceCard.test.mjs
+++ b/apps/web/src/components/settings/PreferenceCard.test.mjs
@@ -74,6 +74,9 @@ describe("reading typography settings", () => {
expect(preferenceCard).toContain('t("settings.editorBodyPaletteTitle")');
expect(preferenceCard).toContain("NoteProsePaletteSwatch");
expect(preferenceCard).toContain("NOTE_PROSE_PALETTES[paletteId].accent");
+ expect(preferenceCard).toContain('t("settings.editorBodyHeadingStyleTitle")');
+ expect(preferenceCard).toContain('t("settings.editorBodyQuoteStyleTitle")');
+ expect(preferenceCard).toContain('t("settings.editorBodyEmphasisStyleTitle")');
expect(preferenceCard).toContain('t("settings.editorBodyCssTitle")');
expect(preferenceCard.slice(preferenceCard.indexOf("editorBodyCssTitle") - 500, preferenceCard.indexOf("editorBodyCssTitle"))).toContain("lg:flex");
expect(preferenceCard).toContain('t("settings.editorBodyCssDescription")');
diff --git a/apps/web/src/components/settings/PreferenceCard.tsx b/apps/web/src/components/settings/PreferenceCard.tsx
index 90d1d818..af8fffc5 100644
--- a/apps/web/src/components/settings/PreferenceCard.tsx
+++ b/apps/web/src/components/settings/PreferenceCard.tsx
@@ -5,11 +5,32 @@ import { FONT_CATALOG, NOTE_BODY_FONT_MENU_GROUPS, isRemoteNoteImageFont, type R
import { FontLoadFeedback } from "@/components/FontLoadFeedback";
import { editorFontLoadState, uiFontLoadState, retryEditorCatalogFont, retryUiCatalogFont } from "@/lib/editor-catalog-fonts";
import { FontLabel } from "@/components/FontLabel";
-import { AlignVerticalSpaceAround, AppWindow, BookOpenText, ChartNoAxesCombined, Code2, Image, Keyboard, Languages, ListTree, MousePointerClick, Palette, Sparkles, SpellCheck, SunMoon, Type } from "lucide-react";
+import { AlignVerticalSpaceAround, AppWindow, BookOpenText, ChartNoAxesCombined, Code2, Heading, Highlighter, Image, Keyboard, Languages, ListTree, MousePointerClick, Palette, Quote, Sparkles, SpellCheck, SunMoon, Type } from "lucide-react";
import { useState, useEffect, useSyncExternalStore, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
-import type { NoteProsePatch, NoteProsePaletteChoice, ResolvedNoteProse } from "@edgeever/shared";
-import { DEFAULT_NOTE_PROSE_CSS, MAX_NOTE_PROSE_CSS_BYTES, NOTE_PROSE_FONT_SIZES, NOTE_PROSE_PALETTE_CHOICES, NOTE_PROSE_PALETTES, noteProseCssDropsDeclarations } from "@edgeever/shared";
+import type {
+ NoteProseEmphasisStyle,
+ NoteProseHeadingStyle,
+ NoteProsePatch,
+ NoteProsePaletteChoice,
+ NoteProseQuoteStyle,
+ ResolvedNoteProse,
+} from "@edgeever/shared";
+import {
+ DEFAULT_NOTE_PROSE_CSS,
+ MAX_NOTE_PROSE_CSS_BYTES,
+ NOTE_PROSE_EMPHASIS_STYLES,
+ NOTE_PROSE_FONT_SIZES,
+ NOTE_PROSE_HEADING_STYLES,
+ NOTE_PROSE_PALETTE_CHOICES,
+ NOTE_PROSE_PALETTES,
+ NOTE_PROSE_QUOTE_STYLES,
+ noteProseCssDropsDeclarations,
+} from "@edgeever/shared";
+import {
+ useNoteProseStylePreference,
+ writeNoteProseStylePreference,
+} from "@/lib/note-prose-style-preference";
import {
EDITOR_SPELLCHECK_CHANGED_EVENT,
readEditorSpellcheckPreference,
@@ -242,6 +263,7 @@ export const PreferenceCard = ({
const [aiSelectionMenuEnabled, setAiSelectionMenuEnabled] = useState(readAiSelectionMenuPreference);
const [aiSpaceShortcutEnabled, setAiSpaceShortcutEnabled] = useState(readAiSpaceShortcutPreference);
const [spellcheckEnabled, setSpellcheckEnabled] = useState(readEditorSpellcheckPreference);
+ const noteProseStyle = useNoteProseStylePreference();
const [editorBodyFont, setEditorBodyFont] = useState(readEditorBodyFontPreference);
const [uiFont, setUiFont] = useState(readUiFontPreference);
@@ -540,6 +562,84 @@ export const PreferenceCard = ({
</div>
</div>
+ <div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="flex min-w-0 items-center gap-3">
+ <Heading className="h-4 w-4 shrink-0 text-slate-500" />
+ <div className="min-w-0">
+ <div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyHeadingStyleTitle")}</div>
+ </div>
+ </div>
+ <div className="w-full shrink-0 sm:w-80">
+ <Select
+ value={noteProseStyle.headingStyle}
+ onValueChange={(value) => writeNoteProseStylePreference({ headingStyle: value as NoteProseHeadingStyle })}
+ >
+ <SelectTrigger aria-label={t("settings.editorBodyHeadingStyleTitle")} className="h-9 bg-card">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {NOTE_PROSE_HEADING_STYLES.map((styleId) => (
+ <SelectItem key={styleId} value={styleId}>
+ {t(`settings.editorBodyHeadingStyles.${styleId}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+
+ <div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="flex min-w-0 items-center gap-3">
+ <Quote className="h-4 w-4 shrink-0 text-slate-500" />
+ <div className="min-w-0">
+ <div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyQuoteStyleTitle")}</div>
+ </div>
+ </div>
+ <div className="w-full shrink-0 sm:w-80">
+ <Select
+ value={noteProseStyle.quoteStyle}
+ onValueChange={(value) => writeNoteProseStylePreference({ quoteStyle: value as NoteProseQuoteStyle })}
+ >
+ <SelectTrigger aria-label={t("settings.editorBodyQuoteStyleTitle")} className="h-9 bg-card">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {NOTE_PROSE_QUOTE_STYLES.map((styleId) => (
+ <SelectItem key={styleId} value={styleId}>
+ {t(`settings.editorBodyQuoteStyles.${styleId}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+
+ <div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="flex min-w-0 items-center gap-3">
+ <Highlighter className="h-4 w-4 shrink-0 text-slate-500" />
+ <div className="min-w-0">
+ <div className={SETTINGS_ITEM_TITLE_CLASSNAME}>{t("settings.editorBodyEmphasisStyleTitle")}</div>
+ </div>
+ </div>
+ <div className="w-full shrink-0 sm:w-80">
+ <Select
+ value={noteProseStyle.emphasisStyle}
+ onValueChange={(value) => writeNoteProseStylePreference({ emphasisStyle: value as NoteProseEmphasisStyle })}
+ >
+ <SelectTrigger aria-label={t("settings.editorBodyEmphasisStyleTitle")} className="h-9 bg-card">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {NOTE_PROSE_EMPHASIS_STYLES.map((styleId) => (
+ <SelectItem key={styleId} value={styleId}>
+ {t(`settings.editorBodyEmphasisStyles.${styleId}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+
<div className="hidden min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4 lg:flex">
<div className="flex min-w-0 items-center gap-3">
<Code2 className="h-4 w-4 shrink-0 text-slate-500" />
diff --git a/apps/web/src/lib/note-print-appearance.test.mjs b/apps/web/src/lib/note-print-appearance.test.mjs
index 34d3f6e8..08d9ef6b 100644
--- a/apps/web/src/lib/note-print-appearance.test.mjs
+++ b/apps/web/src/lib/note-print-appearance.test.mjs
@@ -39,7 +39,8 @@ describe("note print appearance", () => {
expect(css).toContain("color: #14796E");
expect(css).toContain("color: #20AD9D");
expect(css).toContain("accent-color: #20AD9D");
- expect(css).toContain("background: #F2FBFA;");
+ expect(css).toContain("background: #20AD9D;");
+ expect(css).toContain("background: #f9fafb;");
expect(css).not.toContain("border-color: #CDEFEA;");
expect(css).toContain(".edgeever-editor .ProseMirror strong { color: #112233; }");
expect(css).not.toContain("not-a-theme");
diff --git a/apps/web/src/lib/note-print-appearance.ts b/apps/web/src/lib/note-print-appearance.ts
index 96efe8f2..ae5caaeb 100644
--- a/apps/web/src/lib/note-print-appearance.ts
+++ b/apps/web/src/lib/note-print-appearance.ts
@@ -2,6 +2,7 @@ import {
NOTE_PROSE_PALETTES,
noteProseCssVariables,
type NoteProsePaletteChoice,
+ type NoteProseStylePreferences,
type ResolvedNoteProse,
} from "@edgeever/shared";
import { catalogCodeFontStack, isRemoteNoteImageFont } from "@edgeever/shared/font-catalog-data";
@@ -15,9 +16,14 @@ import {
resolveEditorBodyFontStack,
type EditorBodyFontPreference,
} from "@/lib/editor-body-font";
+import {
+ DEFAULT_NOTE_PROSE_STYLE_PREFERENCES,
+ readNoteProseStylePreference,
+} from "@/lib/note-prose-style-preference";
export type NotePrintAppearance = {
palette: NoteProsePaletteChoice;
+ proseStyle?: NoteProseStylePreferences;
cssVariables: Record<string, string>;
customCss: string;
fontFamily: string | null;
@@ -38,8 +44,10 @@ export const notePrintAppearanceFromProse = (
prose: ResolvedNoteProse,
mermaidTheme: string,
font: EditorBodyFontPreference = readEditorBodyFontPreference(),
+ proseStyle: NoteProseStylePreferences = readNoteProseStylePreference(),
): NotePrintAppearance => ({
palette: prose.palette,
+ proseStyle,
cssVariables: noteProseCssVariables(prose),
customCss: sanitizeAndScopeCss(prose.customCss),
fontFamily: resolveEditorBodyFontStack(font) ?? null,
@@ -66,14 +74,72 @@ const paletteRules = (palette: NoteProsePaletteChoice) => {
` accent-color: ${colors.accent};`,
"}",
".edgeever-print-content th {",
- ` background: ${colors.surface};`,
+ ` background: ${colors.accent};`,
+ " color: #ffffff;",
+ " font-weight: 700;",
+ "}",
+ ".edgeever-print-content th strong,",
+ ".edgeever-print-content th b {",
+ " color: #ffffff;",
+ "}",
+ ".edgeever-print-content td strong,",
+ ".edgeever-print-content td b {",
+ " color: #111827;",
"}",
".edgeever-print-content tbody tr:nth-child(even) td {",
- ` background: color-mix(in srgb, ${colors.surface} 60%, transparent);`,
+ " background: #f9fafb;",
"}",
].join("\n");
};
+const proseStyleRules = (
+ palette: NoteProsePaletteChoice,
+ proseStyle: NoteProseStylePreferences = DEFAULT_NOTE_PROSE_STYLE_PREFERENCES,
+) => {
+ const colors = palette === "native" ? null : NOTE_PROSE_PALETTES[palette];
+ const accent = colors?.accent ?? "#374151";
+ const surface = colors?.surface ?? "#f3f4f6";
+ const divider = colors?.divider ?? "#d1d5db";
+ const rules: string[] = [];
+ if (proseStyle.headingStyle === "bar") {
+ rules.push(
+ `.edgeever-print-content h2 { border-left: 4px solid ${accent}; padding-left: 10px; }`,
+ `.edgeever-print-content h3 { border-left: 3px solid ${accent}; padding-left: 8px; }`,
+ );
+ } else if (proseStyle.headingStyle === "numbered") {
+ rules.push(
+ ".edgeever-print-content { counter-reset: note-prose-h2; }",
+ `.edgeever-print-content h2 { 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 { border-left: 3px solid ${accent}; padding-left: 10px; }`,
+ );
+ } else if (proseStyle.headingStyle === "underline") {
+ rules.push(
+ `.edgeever-print-content h2 { padding-bottom: 6px; border-bottom: 1px solid ${divider}; }`,
+ );
+ }
+ if (proseStyle.quoteStyle === "dashed") {
+ rules.push(
+ ".edgeever-print-content blockquote { background: #f9fafb; border: 1px dashed #d1d5db; border-radius: 6px; padding: 12px 16px; }",
+ );
+ } else if (proseStyle.quoteStyle === "accent-bar") {
+ rules.push(
+ `.edgeever-print-content blockquote { background: ${surface}; border: 0; border-left: 3px solid ${accent}; border-radius: 0 6px 6px 0; padding: 12px 16px; }`,
+ );
+ } else if (proseStyle.quoteStyle === "minimal-rule") {
+ rules.push(
+ ".edgeever-print-content blockquote { background: transparent; border: 0; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; border-radius: 0; padding: 12px 4px; }",
+ );
+ }
+ if (proseStyle.emphasisStyle === "marker") {
+ rules.push(
+ `.edgeever-print-content u { text-decoration: none; border-bottom: 2px solid ${divider}; padding-bottom: 1px; }`,
+ ".edgeever-print-content mark { background-color: #fde68a; color: #111827; padding: 1px 4px; border-radius: 2px; }",
+ );
+ }
+ return rules.join("\n");
+};
+
/** Account prose settings for the print page. Values come from the note palette, not from the message text. */
export const notePrintAppearanceCss = (appearance: NotePrintAppearance) => {
const declarations = Object.entries(appearance.cssVariables)
@@ -84,7 +150,12 @@ export const notePrintAppearanceCss = (appearance: NotePrintAppearance) => {
}
const codeStack = catalogCodeFontStack(appearance.fontId);
if (codeStack) declarations.push(`--editor-code-font-family: ${codeStack}`);
- return [`:root { ${declarations.join("; ")}; }`, paletteRules(appearance.palette), appearance.customCss]
+ return [
+ `:root { ${declarations.join("; ")}; }`,
+ paletteRules(appearance.palette),
+ proseStyleRules(appearance.palette, appearance.proseStyle),
+ appearance.customCss,
+ ]
.filter(Boolean)
.join("\n");
};
diff --git a/apps/web/src/lib/note-prose-style-preference.ts b/apps/web/src/lib/note-prose-style-preference.ts
new file mode 100644
index 00000000..05ba011e
--- /dev/null
+++ b/apps/web/src/lib/note-prose-style-preference.ts
@@ -0,0 +1,116 @@
+import { useEffect, useState } from "react";
+import {
+ DEFAULT_NOTE_PROSE_EMPHASIS_STYLE,
+ DEFAULT_NOTE_PROSE_HEADING_STYLE,
+ DEFAULT_NOTE_PROSE_QUOTE_STYLE,
+ parseNoteProseEmphasisStyle,
+ parseNoteProseHeadingStyle,
+ parseNoteProseQuoteStyle,
+ type NoteProseEmphasisStyle,
+ type NoteProseHeadingStyle,
+ type NoteProseQuoteStyle,
+ type NoteProseStylePreferences,
+} from "@edgeever/shared";
+
+export const NOTE_PROSE_STYLE_STORAGE_KEY = "edgeever.note-prose-style";
+export const NOTE_PROSE_STYLE_CHANGED_EVENT = "edgeever:note-prose-style-changed";
+
+let unsavedNoteProseStylePreference: NoteProseStylePreferences | null = null;
+
+export const DEFAULT_NOTE_PROSE_STYLE_PREFERENCES: NoteProseStylePreferences = {
+ headingStyle: DEFAULT_NOTE_PROSE_HEADING_STYLE,
+ quoteStyle: DEFAULT_NOTE_PROSE_QUOTE_STYLE,
+ emphasisStyle: DEFAULT_NOTE_PROSE_EMPHASIS_STYLE,
+};
+
+export const resolveStoredNoteProseStylePreference = (
+ stored: string | null,
+): NoteProseStylePreferences => {
+ if (!stored) return DEFAULT_NOTE_PROSE_STYLE_PREFERENCES;
+ try {
+ const parsed = JSON.parse(stored) as {
+ headingStyle?: unknown;
+ quoteStyle?: unknown;
+ emphasisStyle?: unknown;
+ } | null;
+ if (typeof parsed !== "object" || parsed === null) {
+ return DEFAULT_NOTE_PROSE_STYLE_PREFERENCES;
+ }
+ return {
+ headingStyle: parseNoteProseHeadingStyle(parsed.headingStyle) ?? DEFAULT_NOTE_PROSE_HEADING_STYLE,
+ quoteStyle: parseNoteProseQuoteStyle(parsed.quoteStyle) ?? DEFAULT_NOTE_PROSE_QUOTE_STYLE,
+ emphasisStyle: parseNoteProseEmphasisStyle(parsed.emphasisStyle) ?? DEFAULT_NOTE_PROSE_EMPHASIS_STYLE,
+ };
+ } catch {
+ return DEFAULT_NOTE_PROSE_STYLE_PREFERENCES;
+ }
+};
+
+export const readNoteProseStylePreference = (): NoteProseStylePreferences => {
+ if (unsavedNoteProseStylePreference !== null) return unsavedNoteProseStylePreference;
+ if (typeof window === "undefined") return DEFAULT_NOTE_PROSE_STYLE_PREFERENCES;
+ try {
+ return resolveStoredNoteProseStylePreference(
+ window.localStorage?.getItem(NOTE_PROSE_STYLE_STORAGE_KEY) ?? null,
+ );
+ } catch {
+ return DEFAULT_NOTE_PROSE_STYLE_PREFERENCES;
+ }
+};
+
+export const writeNoteProseStylePreference = (
+ patch: Partial<{
+ headingStyle: NoteProseHeadingStyle;
+ quoteStyle: NoteProseQuoteStyle;
+ emphasisStyle: NoteProseEmphasisStyle;
+ }>,
+): NoteProseStylePreferences => {
+ const current = readNoteProseStylePreference();
+ const next: NoteProseStylePreferences = {
+ headingStyle: parseNoteProseHeadingStyle(patch.headingStyle) ?? current.headingStyle,
+ quoteStyle: parseNoteProseQuoteStyle(patch.quoteStyle) ?? current.quoteStyle,
+ emphasisStyle: parseNoteProseEmphasisStyle(patch.emphasisStyle) ?? current.emphasisStyle,
+ };
+ if (typeof window === "undefined") {
+ unsavedNoteProseStylePreference = next;
+ return next;
+ }
+ try {
+ window.localStorage?.setItem(NOTE_PROSE_STYLE_STORAGE_KEY, JSON.stringify(next));
+ unsavedNoteProseStylePreference = null;
+ } catch {
+ unsavedNoteProseStylePreference = next;
+ }
+ window.dispatchEvent(
+ new CustomEvent(NOTE_PROSE_STYLE_CHANGED_EVENT, { detail: next }),
+ );
+ return next;
+};
+
+export const useNoteProseStylePreference = (): NoteProseStylePreferences => {
+ const [preference, setPreference] = useState<NoteProseStylePreferences>(readNoteProseStylePreference);
+
+ useEffect(() => {
+ const syncPreference = () => setPreference(readNoteProseStylePreference());
+ const handlePreferenceChanged = (event: Event) => {
+ const detail = (event as CustomEvent<NoteProseStylePreferences | undefined>).detail;
+ if (detail && typeof detail === "object") {
+ setPreference({
+ headingStyle: parseNoteProseHeadingStyle(detail.headingStyle) ?? DEFAULT_NOTE_PROSE_HEADING_STYLE,
+ quoteStyle: parseNoteProseQuoteStyle(detail.quoteStyle) ?? DEFAULT_NOTE_PROSE_QUOTE_STYLE,
+ emphasisStyle: parseNoteProseEmphasisStyle(detail.emphasisStyle) ?? DEFAULT_NOTE_PROSE_EMPHASIS_STYLE,
+ });
+ return;
+ }
+ syncPreference();
+ };
+ window.addEventListener(NOTE_PROSE_STYLE_CHANGED_EVENT, handlePreferenceChanged);
+ window.addEventListener("storage", syncPreference);
+ return () => {
+ window.removeEventListener(NOTE_PROSE_STYLE_CHANGED_EVENT, handlePreferenceChanged);
+ window.removeEventListener("storage", syncPreference);
+ };
+ }, []);
+
+ return preference;
+};
diff --git a/apps/web/src/lib/wechat-copy.test.mjs b/apps/web/src/lib/wechat-copy.test.mjs
index 657e5a30..0c3df5f4 100644
--- a/apps/web/src/lib/wechat-copy.test.mjs
+++ b/apps/web/src/lib/wechat-copy.test.mjs
@@ -101,10 +101,11 @@ describe("preparePublishArticle", () => {
expect(css(root.querySelector("code"))).toContain("color:#5B4EE0");
expect(css(root.querySelector("code"))).toContain("background:#F3F1FF");
const th = root.querySelector("th");
- expect(css(th)).toContain("background:#F4F4F5");
+ expect(css(th)).toContain("background:#7351CF");
+ expect(css(th)).toContain("color:#ffffff");
expect(css(th)).toContain("border:1px solid #e5e5e5");
const rows = root.querySelectorAll("tbody tr");
- expect(css(rows[1].querySelector("td"))).toContain("background-color:#F4F4F5");
+ expect(css(rows[1].querySelector("td"))).toContain("background-color:#f9fafb");
} finally {
globalThis.getComputedStyle = previous;
}
@@ -160,6 +161,52 @@ describe("preparePublishArticle", () => {
expect(root.innerHTML).not.toContain("#be123c");
expect(root.innerHTML).not.toContain("#10b981");
});
+
+ test("applies composable emerald, numbered headings, dashed quotes, and marker emphasis for WeChat", () => {
+ const container = document.createElement("div");
+ container.dataset.notePalette = "emerald";
+ container.dataset.noteHeadingStyle = "numbered";
+ container.dataset.noteQuoteStyle = "dashed";
+ container.dataset.noteEmphasisStyle = "marker";
+ const previous = globalThis.getComputedStyle;
+ globalThis.getComputedStyle = () => ({
+ getPropertyValue: (name) => ({
+ "--note-palette-accent": "#059669",
+ "--note-palette-light-accent": "#059669",
+ "--note-palette-text": "#374151",
+ "--note-palette-surface": "#F0FDF4",
+ "--note-palette-divider": "#A7F3D0",
+ "--note-palette-code-bg": "#ECFDF5",
+ "--note-palette-code-text": "#047857",
+ })[name] ?? "",
+ });
+ try {
+ const root = preparePublishArticle([
+ "<h2>章节标题</h2>",
+ "<h3>小节胶囊</h3>",
+ "<blockquote><p><strong>摸鱼绿虚线引用框</strong></p></blockquote>",
+ "<p><strong>翡翠重点</strong> <u>薄荷底线</u> <mark>暖黄高亮</mark> <code>neutralCode</code></p>",
+ ].join(""), container);
+ const h2 = root.querySelector("h2");
+ expect(h2?.textContent).toContain("01");
+ expect(h2?.textContent).toContain("PART");
+ 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:999px");
+ expect(h3?.querySelector("[data-ee-pill-dot]")).not.toBeNull();
+ const quote = root.querySelector("blockquote");
+ expect(css(quote)).toContain("border:1px dashed #d1d5db");
+ expect(css(quote)).toContain("background:#f9fafb");
+ expect(css(quote?.querySelector("strong"))).toContain("border-bottom:3px solid #fde68a");
+ expect(css(root.querySelector("p > strong"))).toContain("color:#059669");
+ expect(css(root.querySelector("u"))).toContain("border-bottom:2px solid #A7F3D0");
+ expect(css(root.querySelector("mark"))).toContain("background-color:#fde68a");
+ expect(css(root.querySelector("code"))).toContain("background:#f3f4f6");
+ } finally {
+ globalThis.getComputedStyle = previous;
+ }
+ });
});
describe("formula snapshots for WeChat", () => {
diff --git a/apps/web/src/lib/wechat-copy.ts b/apps/web/src/lib/wechat-copy.ts
index e5c01837..e554412f 100644
--- a/apps/web/src/lib/wechat-copy.ts
+++ b/apps/web/src/lib/wechat-copy.ts
@@ -6,8 +6,12 @@ import {
NOTE_PROSE_HEADING_SCALE,
NOTE_PROSE_PARAGRAPH_SPACING_PX,
noteProseCodeFontSize,
+ parseNoteProseEmphasisStyle,
+ parseNoteProseHeadingStyle,
parseNoteProseLineHeight,
+ parseNoteProseQuoteStyle,
type NoteProsePaletteColors,
+ type NoteProseStylePreferences,
} from "@edgeever/shared";
import katex from "katex";
import "katex/contrib/mhchem";
@@ -18,6 +22,10 @@ import { MERMAID_THEME_PALETTES } from "@/components/ThemeProvider";
import { scaleMermaidSvg } from "@/lib/mermaid-svg";
import { copyHtmlToClipboard } from "@/lib/clipboard";
import { parseCustomCssToStyles } from "@/lib/css-sandbox";
+import {
+ DEFAULT_NOTE_PROSE_STYLE_PREFERENCES,
+ readNoteProseStylePreference,
+} from "@/lib/note-prose-style-preference";
const PARAGRAPH_SPACING = `${NOTE_PROSE_PARAGRAPH_SPACING_PX}px`;
const PUBLISH_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif";
@@ -54,30 +62,68 @@ const applyLegacyWeChatStyles = (
metrics: WeChatMetrics,
colors: NoteProsePaletteColors | null,
_accentOnly = false,
+ proseStyle: NoteProseStylePreferences = DEFAULT_NOTE_PROSE_STYLE_PREFERENCES,
) => {
const fontSize = `${metrics.fontSize}px`;
const lineHeight = String(metrics.lineHeight);
const codeSize = `${noteProseCodeFontSize(metrics.fontSize)}px`;
// A named hue recolors links, inline code, and bold, matching the editor.
const link = colors?.link ?? LINK_COLOR;
- const inlineCodeColor = colors?.codeText ?? CODE_COLOR;
- const inlineCodeBackground = colors?.codeBackground ?? CODE_BACKGROUND;
- const inlineCodeShadow = colors
- ? "box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);"
- : "box-shadow: inset 0 0 0 1px rgba(61,68,80,0.08);";
- const accent = colors?.accent ?? BODY_COLOR;
+ const inlineCodeColor = proseStyle.headingStyle === "numbered" ? "#1f2937" : (colors?.codeText ?? CODE_COLOR);
+ const inlineCodeBackground = proseStyle.headingStyle === "numbered" ? "#f3f4f6" : (colors?.codeBackground ?? CODE_BACKGROUND);
+ const inlineCodeShadow = proseStyle.headingStyle === "numbered"
+ ? ""
+ : colors
+ ? "box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);"
+ : "box-shadow: inset 0 0 0 1px rgba(61,68,80,0.08);";
+ const accent = colors?.accent ?? "#374151";
+ const surface = colors?.surface ?? "#f3f4f6";
+ const divider = colors?.divider ?? "#d1d5db";
const bold = colors ? `font-weight: 800; color: ${accent};` : "font-weight: 800;";
- const thBackground = colors ? colors.surface : "#f5f5f5";
+ const thBackground = colors ? colors.accent : "#f3f4f6";
+ const thColor = colors ? "#ffffff" : "#111827";
const textStyle = `font-family: ${PUBLISH_FONT}; font-size: ${fontSize}; line-height: ${lineHeight}; letter-spacing: -0.005em; color: ${BODY_COLOR};`;
+ const h2Base = headingStyle("h2", metrics);
+ const h3Base = headingStyle("h3", metrics);
+ const h2Style = proseStyle.headingStyle === "bar"
+ ? `${h2Base.replace(/padding:\s*0;/, "padding: 0 0 0 10px;")} border-left: 4px solid ${accent};`
+ : proseStyle.headingStyle === "numbered"
+ ? "margin: 36px 0 24px; padding: 0; font-size: 0; line-height: 1.35;"
+ : proseStyle.headingStyle === "underline"
+ ? `${h2Base.replace(/padding:\s*0;/, "padding: 0 0 6px;")} border-bottom: 1px solid ${colors?.divider ?? "#e5e7eb"};`
+ : h2Base;
+ const h3Style = proseStyle.headingStyle === "bar"
+ ? `${h3Base.replace(/padding:\s*0;/, "padding: 0 0 0 8px;")} border-left: 3px solid ${accent};`
+ : proseStyle.headingStyle === "numbered"
+ ? `display: inline-block; margin: 18px 0 8px; padding: 4px 12px; border-radius: 999px; background: ${surface}; color: ${accent}; font-family: ${PUBLISH_FONT}; font-size: 13px; font-weight: 700; line-height: 1.5;`
+ : 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: 14px; font-weight: 800; line-height: 1.5;`
+ : headingStyle("h4", metrics);
+ const blockquoteStyle = proseStyle.quoteStyle === "dashed"
+ ? `margin: 0 0 20px; padding: 12px 16px; border: 1px dashed #d1d5db; border-radius: 8px; background: #f9fafb; color: ${QUOTE_COLOR}; font-family: ${PUBLISH_FONT}; line-height: ${lineHeight};`
+ : proseStyle.quoteStyle === "accent-bar"
+ ? `margin: 0 0 16px; padding: 12px 16px; border: 0; border-left: 3px solid ${accent}; border-radius: 0 6px 6px 0; background: ${surface}; color: ${QUOTE_COLOR}; font-family: ${PUBLISH_FONT}; line-height: ${lineHeight};`
+ : proseStyle.quoteStyle === "minimal-rule"
+ ? `margin: 0 0 16px; padding: 12px 4px; border: 0; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; border-radius: 0; background: transparent; color: ${QUOTE_COLOR}; font-family: ${PUBLISH_FONT}; line-height: ${lineHeight};`
+ : `margin: 0 0 16px; padding: 12px 16px; border: 0; border-radius: 8px; background: #f3f5f7; color: ${QUOTE_COLOR}; font-family: ${PUBLISH_FONT}; line-height: ${lineHeight};`;
+ const preStyle = proseStyle.quoteStyle === "dashed"
+ ? `margin: 0 0 20px; padding: 14px 18px; overflow: hidden; border: 0; border-left: 3px solid ${accent}; border-radius: 0 8px 8px 0; background: #f9fafb; color: #0f172a; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; line-height: 1.75; text-align: left; white-space: pre-wrap;`
+ : `margin: 0 0 16px; padding: 14px 16px; overflow: hidden; border: 1px solid #e4e4e4; border-radius: 8px; background: #fafafa; color: #0f172a; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; line-height: 1.6; text-align: left; white-space: pre-wrap;`;
+ const thStyle = `padding: 8px 13px; border: 1px solid #e5e5e5; background: ${thBackground}; color: ${thColor}; font-weight: 700; font-size: 13px; text-align: left;`;
+ const imgStyle = proseStyle.headingStyle === "numbered"
+ ? "display: block; max-width: 100%; height: auto; margin: 16px 0; padding: 6px; box-sizing: border-box; background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 4px 12px -2px rgba(0,0,0,0.08);"
+ : "display: block; max-width: 100%; height: auto; margin: 16px 0; border: 1px solid #b8dfd0; border-radius: 8px;";
+ const paragraphBottom = proseStyle.headingStyle === "numbered" ? "16px" : PARAGRAPH_SPACING;
const styles: Record<string, string> = {
- p: `margin: 0 0 ${PARAGRAPH_SPACING}; padding: 0; ${textStyle}`,
+ p: `margin: 0 0 ${paragraphBottom}; padding: 0; ${textStyle}`,
h1: headingStyle("h1", metrics),
- h2: headingStyle("h2", metrics),
- h3: headingStyle("h3", metrics),
- h4: headingStyle("h4", metrics),
+ h2: h2Style,
+ h3: h3Style,
+ h4: h4Style,
h5: headingStyle("h5", metrics),
h6: headingStyle("h6", metrics),
- blockquote: `margin: 0 0 16px; padding: 12px 16px; border: 0; border-radius: 8px; background: #f3f5f7; color: ${QUOTE_COLOR}; font-family: ${PUBLISH_FONT}; line-height: ${lineHeight};`,
+ blockquote: blockquoteStyle,
ul: `margin: 0 0 16px; padding-left: 24px; line-height: ${lineHeight}; list-style-type: disc;`,
ol: `margin: 0 0 16px; padding-left: 24px; line-height: ${lineHeight}; list-style-type: decimal;`,
li: `margin: 4px 0; line-height: ${lineHeight}; ${textStyle}`,
@@ -86,13 +132,21 @@ const applyLegacyWeChatStyles = (
b: bold,
em: "font-style: italic;",
del: "text-decoration: line-through;",
- code: `padding: 1px 4px; border: 0; border-radius: 4px; background: ${inlineCodeBackground}; ${inlineCodeShadow} color: ${inlineCodeColor}; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; font-weight: 400;`,
- pre: `margin: 0 0 16px; padding: 14px 16px; overflow: hidden; border: 1px solid #e4e4e4; border-radius: 8px; background: #fafafa; color: #0f172a; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; line-height: 1.6; text-align: left; white-space: pre-wrap;`,
- hr: "margin: 24px 0; border: 0; border-top: 1px solid #1a1d21;",
+ ...(proseStyle.emphasisStyle === "marker"
+ ? {
+ u: `text-decoration: none; border-bottom: 2px solid ${divider}; padding-bottom: 1px; color: ${BODY_COLOR}; font-weight: 600;`,
+ mark: "background-color: #fde68a; color: #111827; padding: 1px 4px; border-radius: 2px; font-weight: 600;",
+ }
+ : {}),
+ code: `padding: 2px 6px; border: 0; border-radius: 4px; background: ${inlineCodeBackground}; ${inlineCodeShadow} color: ${inlineCodeColor}; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; font-weight: ${proseStyle.headingStyle === "numbered" ? 600 : 400};`,
+ pre: preStyle,
+ hr: proseStyle.headingStyle === "numbered"
+ ? "margin: 28px 0; border: 0; border-top: 1px solid #e5e7eb;"
+ : "margin: 24px 0; border: 0; border-top: 1px solid #1a1d21;",
table: `width: 100%; margin: 20px 0; border-collapse: collapse; font-size: ${fontSize}; line-height: 1.45;`,
- th: `padding: 8px 13px; border: 1px solid #e5e5e5; background: ${thBackground}; color: #0f172a; font-weight: 600; font-size: 13px; text-align: left;`,
+ th: thStyle,
td: `padding: 8px 13px; border: 1px solid #e5e5e5; color: ${BODY_COLOR}; text-align: left;`,
- img: "display: block; max-width: 100%; height: auto; margin: 16px 0; border: 1px solid #b8dfd0; border-radius: 8px;",
+ img: imgStyle,
};
root.style.cssText = `${textStyle} background-color: #ffffff; word-break: break-word;`;
@@ -114,21 +168,133 @@ const applyLegacyWeChatStyles = (
if (style) element.style.cssText = `${style}${element.style.cssText}`;
});
+ if (proseStyle.emphasisStyle === "marker") {
+ root.querySelectorAll<HTMLElement>("p > strong, p > b, li > strong, li > b").forEach((element) => {
+ if (element.closest("td, th, h1, h2, h3, h4, h5, h6")) return;
+ element.style.cssText = `${element.style.cssText}; border-bottom: 2px solid ${divider}; padding-bottom: 1px;`;
+ });
+ root.querySelectorAll<HTMLElement>("blockquote strong, blockquote b").forEach((element) => {
+ element.style.cssText = `${element.style.cssText}; color: ${accent}; font-weight: 700; border-bottom: 3px solid #fde68a; padding-bottom: 2px;`;
+ });
+ }
+
+ if (proseStyle.headingStyle === "numbered") {
+ root.querySelectorAll<HTMLElement>("h1").forEach((heading) => {
+ if (heading.querySelector("[data-ee-cover-card]")) return;
+ const titleHtml = heading.innerHTML;
+ heading.style.cssText = `margin: 0 0 28px; padding: 0; background: #ffffff; border: 1.5px solid ${divider}; border-radius: 20px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.06);`;
+ heading.innerHTML = [
+ `<section data-ee-publish-chrome="true" data-ee-cover-card="true" style="padding: 28px 24px 22px;">`,
+ `<section data-ee-publish-chrome="true" style="margin-bottom: 18px; font-size: 0;">`,
+ `<span data-ee-publish-chrome="true" style="display: inline-block; width: 6px; height: 6px; background: ${accent}; border-radius: 50%; vertical-align: middle;"><span leaf=""><br></span></span>`,
+ `<span data-ee-publish-chrome="true" style="display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 3px; color: ${accent}; vertical-align: middle; margin-left: 8px;">FEATURED · 深度实测</span>`,
+ `</section>`,
+ `<p data-ee-publish-chrome="true" style="font-size: 23px; font-weight: 900; color: #111827; margin: 0 0 14px; line-height: 1.2; letter-spacing: -0.5px;">${titleHtml}</p>`,
+ `<section data-ee-publish-chrome="true" style="width: 48px; height: 3px; background: ${accent}; border-radius: 2px;"><span leaf=""><br></span></section>`,
+ `</section>`,
+ `<section data-ee-publish-chrome="true" style="background: ${colors ? accent : "#f3f4f6"}; padding: 10px 24px; font-size: 0;">`,
+ `<span data-ee-publish-chrome="true" style="display: inline-block; font-size: 11px; color: ${colors ? "rgba(255,255,255,0.92)" : "#374151"}; font-weight: 600; letter-spacing: 0.8px; vertical-align: middle;">EDGEEVER · 精选笔记</span>`,
+ `</section>`,
+ ].join("");
+ });
+
+ const h2List = Array.from(root.querySelectorAll<HTMLElement>("h2"));
+ h2List.forEach((heading) => {
+ const prev = heading.previousElementSibling;
+ if (prev && prev.tagName === "HR") {
+ prev.remove();
+ }
+ });
+ if (h2List.length >= 2 && !root.querySelector("[data-ee-toc-cards]")) {
+ const toc = document.createElement("section");
+ toc.setAttribute("data-ee-publish-chrome", "true");
+ toc.setAttribute("data-ee-toc-cards", "true");
+ toc.style.cssText = "margin: 0 0 28px;";
+ const cardsHtml = h2List.map((heading, index) => {
+ const num = String(index + 1).padStart(2, "0");
+ const rawText = (heading.textContent || "")
+ .replace(/^\s*(?:第[一二三四五六七八九十百\d]+[章节部分篇]\s*[::·.\s]*|\d+\s*[.、·::]\s*|[一二三四五六七八九十]+\s*[、..]\s*)/u, "")
+ .trim();
+ const shortTitle = rawText.slice(0, 6) || `章节 ${num}`;
+ const subTitle = rawText.length > 6 ? rawText.slice(6, 18) : `PART ${num}`;
+ const isHighlighted = index < h2List.length - 1 || h2List.length === 2 && index === 0;
+ const useSolidAccent = isHighlighted && Boolean(colors);
+ if (useSolidAccent) {
+ return [
+ `<section data-ee-publish-chrome="true" style="display: inline-block; vertical-align: top; width: 136px; box-sizing: border-box; background: ${accent}; border-radius: 12px; padding: 12px; margin: 0 8px 8px 0;">`,
+ `<p data-ee-publish-chrome="true" style="font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.72); letter-spacing: 1px; margin: 0 0 5px;">${num}</p>`,
+ `<p data-ee-publish-chrome="true" style="font-size: 13px; font-weight: 800; color: #ffffff; margin: 0 0 3px; line-height: 1.3;">${shortTitle}</p>`,
+ `<p data-ee-publish-chrome="true" style="font-size: 10px; color: rgba(255,255,255,0.75); margin: 0; line-height: 1.4;">${subTitle}</p>`,
+ `</section>`,
+ ].join("");
+ }
+ return [
+ `<section data-ee-publish-chrome="true" style="display: inline-block; vertical-align: top; width: 136px; box-sizing: border-box; background: ${isHighlighted ? "#f3f4f6" : "#ffffff"}; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; margin: 0 8px 8px 0;">`,
+ `<p data-ee-publish-chrome="true" style="font-size: 9px; font-weight: 700; color: #6b7280; letter-spacing: 1px; margin: 0 0 5px;">${num}</p>`,
+ `<p data-ee-publish-chrome="true" style="font-size: 13px; font-weight: 800; color: #111827; margin: 0 0 3px; line-height: 1.3;">${shortTitle}</p>`,
+ `<p data-ee-publish-chrome="true" style="font-size: 10px; color: #6b7280; margin: 0; line-height: 1.4;">${subTitle}</p>`,
+ `</section>`,
+ ].join("");
+ }).join("");
+ toc.innerHTML = [
+ `<section data-ee-publish-chrome="true" style="margin-bottom: 10px;">`,
+ `<p data-ee-publish-chrome="true" style="font-size: 10px; color: #9ca3af; margin: 0; text-transform: uppercase; letter-spacing: 2px; font-weight: 600;">${h2List.length} PARTS · 全文导览</p>`,
+ `</section>`,
+ `<section data-ee-publish-chrome="true" style="font-size: 0;">${cardsHtml}</section>`,
+ ].join("");
+ h2List[0].parentElement?.insertBefore(toc, h2List[0]);
+ }
+
+ h2List.forEach((heading, index) => {
+ if (heading.querySelector("[data-ee-heading-number]")) return;
+ const num = String(index + 1).padStart(2, "0");
+ const isLast = h2List.length > 1 && index === h2List.length - 1;
+ const partLabel = isLast ? "LAST" : "PART";
+ const subLabel = isLast ? "SUMMARY · 核心总结与延伸" : `SECTION ${num} · 章节核心脉络`;
+ const titleHtml = heading.innerHTML;
+ heading.innerHTML = [
+ `<section data-ee-publish-chrome="true" data-ee-heading-number="true" style="display: inline-block; vertical-align: middle; text-align: center; width: 52px;">`,
+ `<p data-ee-publish-chrome="true" style="margin: 0; font-size: 28px; font-weight: 900; color: ${accent}; line-height: 1; letter-spacing: -2px;">${num}</p>`,
+ `<p data-ee-publish-chrome="true" style="margin: 2px 0 0; font-size: 8px; font-weight: 700; color: #d1d5db; letter-spacing: 2px; line-height: 1;">${partLabel}</p>`,
+ `</section>`,
+ `<span data-ee-publish-chrome="true" style="display: inline-block; width: 1px; height: 36px; background: #e5e7eb; vertical-align: middle; margin: 0 16px;"><span leaf=""><br></span></span>`,
+ `<section data-ee-publish-chrome="true" style="display: inline-block; vertical-align: middle; max-width: calc(100% - 86px);">`,
+ `<p data-ee-publish-chrome="true" style="margin: 0; font-size: 17px; font-weight: 900; color: #111827; letter-spacing: 0.3px; line-height: 1.3;">${titleHtml}</p>`,
+ `<p data-ee-publish-chrome="true" style="margin: 3px 0 0; font-size: 11px; font-weight: 400; color: #9ca3af; letter-spacing: 0.4px; line-height: 1.3;">${subLabel}</p>`,
+ `</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: 6px; height: 6px; background: ${accent}; border-radius: 50%; margin-right: 6px; vertical-align: middle;`;
+ dot.innerHTML = "<span leaf=\"\"><br></span>";
+ heading.insertBefore(dot, heading.firstChild);
+ });
+ }
+
root.querySelectorAll<HTMLElement>("pre code").forEach((element) => {
element.style.cssText = `padding: 0; border: 0; background: transparent; color: inherit; font-family: ${PUBLISH_MONO}; font-size: ${codeSize}; font-weight: 400; white-space: pre-wrap;`;
});
- if (colors) {
- root.querySelectorAll<HTMLElement>("table").forEach((table) => {
- table.querySelectorAll<HTMLElement>("tbody tr").forEach((tr, index) => {
- if (index % 2 === 1) {
- tr.querySelectorAll<HTMLElement>("td").forEach((td) => {
- td.style.backgroundColor = colors.surface;
- });
- }
- });
+ root.querySelectorAll<HTMLElement>("table").forEach((table) => {
+ table.querySelectorAll<HTMLElement>("tbody tr").forEach((tr, index) => {
+ if (index % 2 === 1) {
+ tr.querySelectorAll<HTMLElement>("td").forEach((td) => {
+ td.style.backgroundColor = "#f9fafb";
+ });
+ }
});
- }
+ table.querySelectorAll<HTMLElement>("th strong, th b").forEach((el) => {
+ el.style.color = thColor;
+ });
+ table.querySelectorAll<HTMLElement>("td strong, td b").forEach((el) => {
+ el.style.color = "#111827";
+ });
+ });
};
const applyInlineStyles = (
@@ -137,8 +303,9 @@ const applyInlineStyles = (
colors: NoteProsePaletteColors | null,
customCss?: string,
accentOnly = false,
+ proseStyle: NoteProseStylePreferences = DEFAULT_NOTE_PROSE_STYLE_PREFERENCES,
) => {
- applyLegacyWeChatStyles(root, metrics, colors, accentOnly);
+ applyLegacyWeChatStyles(root, metrics, colors, accentOnly, proseStyle);
const customStyles = customCss ? parseCustomCssToStyles(customCss) : null;
if (!customStyles) return;
@@ -1085,12 +1252,20 @@ export const readEditorCopyContext = (from?: HTMLElement | null) => {
}
}
const customStyleTag = container?.querySelector<HTMLStyleElement>("style[data-theme-custom-css]");
+ const storedStyle = readNoteProseStylePreference();
+ const proseStyle: NoteProseStylePreferences = {
+ headingStyle: parseNoteProseHeadingStyle(container?.dataset.noteHeadingStyle) ?? storedStyle.headingStyle,
+ quoteStyle: parseNoteProseQuoteStyle(container?.dataset.noteQuoteStyle) ?? storedStyle.quoteStyle,
+ emphasisStyle: parseNoteProseEmphasisStyle(container?.dataset.noteEmphasisStyle) ?? storedStyle.emphasisStyle,
+ };
return {
fontSize,
lineHeight,
colors,
accentOnly: Boolean(palette && palette !== "native"),
customCss: customStyleTag?.dataset.originalCss || "",
+ proseStyle,
+ noteTitle: container?.dataset.noteTitle?.trim() || "",
};
};
@@ -1102,6 +1277,11 @@ export const preparePublishArticle = (
root.innerHTML = html;
flattenDetailsForLinearHtml(root);
const context = readEditorCopyContext(from);
+ if (context.proseStyle.headingStyle === "numbered" && context.noteTitle && !root.querySelector("h1")) {
+ const coverH1 = document.createElement("h1");
+ coverH1.textContent = context.noteTitle;
+ root.insertBefore(coverH1, root.firstChild);
+ }
const metrics = { fontSize: context.fontSize, lineHeight: context.lineHeight };
applyInlineStyles(
root,
@@ -1109,6 +1289,7 @@ export const preparePublishArticle = (
context.colors,
context.customCss,
context.accentOnly,
+ context.proseStyle,
);
replaceMathNodes(root, metrics);
convertTaskLists(root, context.colors?.accent ?? null);
diff --git a/apps/web/src/styles/editor-typography.test.mjs b/apps/web/src/styles/editor-typography.test.mjs
index 744421cb..01a48eb1 100644
--- a/apps/web/src/styles/editor-typography.test.mjs
+++ b/apps/web/src/styles/editor-typography.test.mjs
@@ -40,6 +40,9 @@ describe("editor typography contract", () => {
expect(editorPane).toContain('data-editor-theme="default"');
expect(editorPane).toContain("data-note-palette={noteProse.palette}");
+ expect(editorPane).toContain("data-note-heading-style={noteProseStyle.headingStyle}");
+ expect(editorPane).toContain("data-note-quote-style={noteProseStyle.quoteStyle}");
+ expect(editorPane).toContain("data-note-emphasis-style={noteProseStyle.emphasisStyle}");
expect(editorPane).toContain("noteProseCssVariables(noteProse)");
expect(editorPane).not.toContain("isPaperEditorTheme");
expect(editorPane).toContain("MEMO_CONTENT_STYLE.divider");
@@ -92,7 +95,8 @@ describe("editor typography contract", () => {
expect(prose).toMatch(/ul\[data-type="taskList"\] li\[data-checked\] > label input/);
expect(prose).toMatch(/\.ProseMirror code/);
expect(prose).toMatch(/\.ProseMirror pre code/);
- expect(prose).toMatch(/background:\s*var\(--note-palette-surface\)/);
+ expect(prose).toMatch(/background:\s*var\(--note-palette-accent\)/);
+ expect(prose).toMatch(/background:\s*#f9fafb/);
const globals = readStyle("./globals.css");
expect(declarationsForSelector(globals, ".ProseMirror code")).toContain("color: #3d4450;");
expect(prose).not.toMatch(/--note-palette-text/);
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index d2481080..afeb16d6 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -4,6 +4,7 @@
@import "./editor-themes/index.css";
@import "./publish-layout.css";
@import "./note-prose.css";
+@import "./note-prose-styles.css";
@import "./code-highlight-dark.css";
@source "../../node_modules/streamdown/dist";
@@ -2771,13 +2772,27 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
.ProseMirror th,
.markdown-content th {
- background: rgb(var(--slate-100-rgb) / 0.75);
- color: #0f172a;
+ background: #f3f4f6;
+ color: #111827;
font-size: 0.84rem;
- font-weight: 600;
+ font-weight: 700;
letter-spacing: -0.01em;
}
+.ProseMirror th strong,
+.ProseMirror th b,
+.markdown-content th strong,
+.markdown-content th b {
+ color: inherit;
+}
+
+.ProseMirror td strong,
+.ProseMirror td b,
+.markdown-content td strong,
+.markdown-content td b {
+ color: #111827;
+}
+
.ProseMirror th:last-child,
.ProseMirror td:last-child,
.markdown-content th:last-child,
@@ -2792,7 +2807,7 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
.ProseMirror tbody tr:nth-child(even) td,
.markdown-content tbody tr:nth-child(even) td {
- background: rgb(var(--slate-50-rgb) / 0.5);
+ background: #f9fafb;
}
.ProseMirror tbody tr:hover td,
@@ -2844,10 +2859,17 @@ html[data-edgeever-extension-theme] .edgeever-memo-divider {
:root.dark .ProseMirror th,
:root.dark .markdown-content th {
- background: rgb(255 255 255 / 0.035);
+ background: rgb(255 255 255 / 0.06);
color: hsl(var(--foreground));
}
+:root.dark .ProseMirror td strong,
+:root.dark .ProseMirror td b,
+:root.dark .markdown-content td strong,
+:root.dark .markdown-content td b {
+ color: #f3f4f6;
+}
+
:root.dark .ProseMirror .tableWrapper,
:root.dark .markdown-content .tableWrapper {
border-color: rgb(var(--slate-200-rgb) / 0.9);
diff --git a/apps/web/src/styles/note-prose-styles.css b/apps/web/src/styles/note-prose-styles.css
new file mode 100644
index 00000000..77b587ed
--- /dev/null
+++ b/apps/web/src/styles/note-prose-styles.css
@@ -0,0 +1,373 @@
+/* Composable reading styles for headings, blockquotes, and inline emphasis. */
+
+/* 1. Heading style: Left bar ("bar") */
+.edgeever-editor[data-note-heading-style="bar"] .ProseMirror h2,
+.edgeever-editor[data-note-heading-style="bar"] .markdown-content h2 {
+ border-left: 4px solid var(--note-palette-accent, #374151);
+ padding-left: 10px;
+}
+
+.edgeever-editor[data-note-heading-style="bar"] .ProseMirror h3,
+.edgeever-editor[data-note-heading-style="bar"] .markdown-content h3 {
+ border-left: 3px solid color-mix(in srgb, var(--note-palette-accent, #374151) 55%, transparent);
+ padding-left: 8px;
+}
+
+/* 2. Heading style: Numbered magazine sections ("numbered" — Moyu Green chapter style) */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content {
+ counter-reset: note-prose-h2;
+ letter-spacing: 0.5px;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror p,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content p {
+ margin-bottom: 16px;
+ text-align: justify;
+}
+
+/* H1: Magazine cover-breaking card */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h1,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h1 {
+ position: relative;
+ margin: 0.5rem 0 2rem;
+ padding: 28px 24px 52px;
+ background: #ffffff;
+ border: 1.5px solid color-mix(in srgb, var(--note-palette-accent, #374151) 18%, transparent);
+ border-radius: 20px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
+ font-size: 24px;
+ font-weight: 900;
+ line-height: 1.25;
+ letter-spacing: -0.5px;
+ color: #111827;
+ overflow: hidden;
+}
+
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h1,
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content h1 {
+ background: rgba(255, 255, 255, 0.03);
+ border-color: color-mix(in srgb, var(--note-palette-accent, #9ca3af) 28%, transparent);
+ color: #f3f4f6;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h1::before,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h1::before {
+ content: "● FEATURED · 深度实测";
+ display: block;
+ margin-bottom: 16px;
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: 3px;
+ line-height: 1.2;
+ color: var(--note-palette-accent, #374151);
+ pointer-events: none;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h1::after,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h1::after {
+ content: "EDGEEVER · 精选笔记";
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ padding: 10px 24px;
+ background: linear-gradient(
+ 135deg,
+ var(--note-palette-accent, #374151),
+ color-mix(in srgb, var(--note-palette-accent, #374151) 80%, #ffffff)
+ );
+ color: rgba(255, 255, 255, 0.92);
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: 1px;
+ line-height: 1.4;
+ pointer-events: none;
+}
+
+.edgeever-editor[data-note-palette="native"][data-note-heading-style="numbered"] .ProseMirror h1::after,
+.edgeever-editor[data-note-palette="native"][data-note-heading-style="numbered"] .markdown-content h1::after {
+ background: #f3f4f6;
+ border-top: 1px solid #e5e7eb;
+ color: #374151;
+}
+
+/* H2: Two-column 01 / PART + 36px vertical divider + two-line right title & subtitle */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror hr:has(+ h2),
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content hr:has(+ h2) {
+ display: none;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror hr,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content hr {
+ border-top: 1px solid #e5e7eb !important;
+ margin: 28px 0 !important;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2 {
+ counter-increment: note-prose-h2;
+ position: relative;
+ margin-top: 2.75rem;
+ margin-bottom: 1.5rem;
+ padding: 2px 0 2px 82px;
+ min-height: 40px;
+ display: block;
+ border: 0;
+ font-size: 17px;
+ font-weight: 900;
+ color: #111827;
+ letter-spacing: 0.3px;
+ line-height: 1.3;
+}
+
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2,
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2 {
+ color: #f3f4f6;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2::before,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2::before {
+ content: counter(note-prose-h2, decimal-leading-zero);
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 66px;
+ height: 38px;
+ padding-right: 16px;
+ box-sizing: border-box;
+ text-align: center;
+ font-size: 28px;
+ font-weight: 900;
+ color: var(--note-palette-accent, #374151);
+ line-height: 25px;
+ letter-spacing: -2px;
+ font-variant-numeric: tabular-nums;
+ border-right: 1px solid #e5e7eb;
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='11' viewBox='0 0 50 11'%3E%3Ctext x='25' y='9' text-anchor='middle' font-family='-apple-system,BlinkMacSystemFont,sans-serif' font-size='8' font-weight='700' letter-spacing='2' fill='%23d1d5db'%3EPART%3C/text%3E%3C/svg%3E");
+ background-repeat: no-repeat;
+ background-position: left 0 bottom 0;
+ pointer-events: none;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2:last-of-type::before,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2:last-of-type::before {
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='11' viewBox='0 0 50 11'%3E%3Ctext x='25' y='9' text-anchor='middle' font-family='-apple-system,BlinkMacSystemFont,sans-serif' font-size='8' font-weight='700' letter-spacing='2' fill='%23d1d5db'%3ELAST%3C/text%3E%3C/svg%3E");
+}
+
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2::before,
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2::before {
+ border-right-color: rgba(255, 255, 255, 0.14);
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2::after,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2::after {
+ content: "SECTION " counter(note-prose-h2, decimal-leading-zero) " · 章节核心脉络";
+ display: block;
+ margin-top: 3px;
+ font-size: 11px;
+ font-weight: 400;
+ color: #9ca3af;
+ letter-spacing: 0.4px;
+ line-height: 1.3;
+ pointer-events: none;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h2:last-of-type::after,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h2:last-of-type::after {
+ content: "SUMMARY · 核心总结与延伸";
+}
+
+/* H3: Green pill badge with solid dot */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h3,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h3 {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ margin-top: 1.1rem;
+ margin-bottom: 0.5rem;
+ padding: 4px 12px;
+ border: 0;
+ border-radius: 999px;
+ background: color-mix(in srgb, var(--note-palette-accent, #374151) 9%, transparent);
+ color: var(--note-palette-accent, #374151);
+ font-size: 13px;
+ font-weight: 700;
+ line-height: 1.5;
+}
+
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h3::before,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h3::before {
+ content: "";
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--note-palette-accent, #374151);
+ flex-shrink: 0;
+ pointer-events: none;
+}
+
+/* H4: Warm yellow highlight sub-heading */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror h4,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content h4 {
+ display: inline-block;
+ margin-top: 1rem;
+ margin-bottom: 0.45rem;
+ padding: 1px 6px;
+ border-radius: 3px;
+ background: #fde68a;
+ color: #111827;
+ font-size: 14px;
+ font-weight: 800;
+}
+
+/* Inline code in numbered magazine mode: neutral cool gray so green strong text stands out */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror :not(pre) > code,
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content :not(pre) > code {
+ background: #f3f4f6 !important;
+ color: #1f2937 !important;
+ box-shadow: none !important;
+ font-weight: 600;
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .ProseMirror :not(pre) > code,
+:root.dark .edgeever-editor[data-note-heading-style="numbered"] .markdown-content :not(pre) > code {
+ background: rgba(255, 255, 255, 0.08) !important;
+ color: #e5e7eb !important;
+}
+
+/* Image card frame in numbered magazine mode */
+.edgeever-editor[data-note-heading-style="numbered"] .ProseMirror img:not(.ProseMirror-separator),
+.edgeever-editor[data-note-heading-style="numbered"] .markdown-content img {
+ background: #ffffff;
+ border-radius: 12px;
+ padding: 6px;
+ border: 1px solid #e5e7eb;
+ box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
+}
+
+/* 3. Heading style: Bottom rule ("underline") */
+.edgeever-editor[data-note-heading-style="underline"] .ProseMirror h2,
+.edgeever-editor[data-note-heading-style="underline"] .markdown-content h2 {
+ padding-bottom: 6px;
+ border-bottom: 1px solid var(--note-palette-divider, #e5e7eb);
+}
+
+:root.dark .edgeever-editor[data-note-heading-style="underline"] .ProseMirror h2,
+:root.dark .edgeever-editor[data-note-heading-style="underline"] .markdown-content h2 {
+ border-bottom-color: color-mix(in srgb, var(--note-palette-accent, #94a3b8) 32%, transparent);
+}
+
+/* 4. Quote style: Dashed card ("dashed" — Moyu Green quote card & code block accent bar) */
+.edgeever-editor[data-note-quote-style="dashed"] .ProseMirror blockquote,
+.edgeever-editor[data-note-quote-style="dashed"] .markdown-content blockquote {
+ background: #f9fafb;
+ border: 1px dashed #d1d5db;
+ border-radius: 8px;
+ padding: 12px 16px;
+ margin-bottom: 20px;
+}
+
+.edgeever-editor[data-note-quote-style="dashed"] .ProseMirror pre,
+.edgeever-editor[data-note-quote-style="dashed"] .ProseMirror .edgeever-code-block,
+.edgeever-editor[data-note-quote-style="dashed"] .markdown-content pre {
+ background: #f9fafb;
+ border: 0;
+ border-left: 3px solid var(--note-palette-accent, #374151);
+ border-radius: 0 8px 8px 0;
+}
+
+:root.dark .edgeever-editor[data-note-quote-style="dashed"] .ProseMirror blockquote,
+:root.dark .edgeever-editor[data-note-quote-style="dashed"] .markdown-content blockquote {
+ background: rgba(255, 255, 255, 0.03);
+ border-color: rgba(255, 255, 255, 0.18);
+}
+
+:root.dark .edgeever-editor[data-note-quote-style="dashed"] .ProseMirror pre,
+:root.dark .edgeever-editor[data-note-quote-style="dashed"] .ProseMirror .edgeever-code-block,
+:root.dark .edgeever-editor[data-note-quote-style="dashed"] .markdown-content pre {
+ background: rgba(255, 255, 255, 0.04);
+ border-left-color: var(--note-palette-accent, #9ca3af);
+}
+
+/* 5. Quote style: Accent left bar ("accent-bar") */
+.edgeever-editor[data-note-quote-style="accent-bar"] .ProseMirror blockquote,
+.edgeever-editor[data-note-quote-style="accent-bar"] .markdown-content blockquote {
+ background: var(--note-palette-surface, #f8fafc);
+ border: 0;
+ border-left: 3px solid var(--note-palette-accent, #374151);
+ border-radius: 0 6px 6px 0;
+ padding: 12px 16px;
+}
+
+:root.dark .edgeever-editor[data-note-quote-style="accent-bar"] .ProseMirror blockquote,
+:root.dark .edgeever-editor[data-note-quote-style="accent-bar"] .markdown-content blockquote {
+ background: color-mix(in srgb, var(--note-palette-accent, #9ca3af) 8%, transparent);
+ border-left-color: var(--note-palette-accent, #9ca3af);
+}
+
+/* 6. Quote style: Minimal rule ("minimal-rule") */
+.edgeever-editor[data-note-quote-style="minimal-rule"] .ProseMirror blockquote,
+.edgeever-editor[data-note-quote-style="minimal-rule"] .markdown-content blockquote {
+ background: transparent;
+ border: 0;
+ border-top: 1px solid #e5e7eb;
+ border-bottom: 1px solid #e5e7eb;
+ border-radius: 0;
+ padding: 12px 4px;
+}
+
+:root.dark .edgeever-editor[data-note-quote-style="minimal-rule"] .ProseMirror blockquote,
+:root.dark .edgeever-editor[data-note-quote-style="minimal-rule"] .markdown-content blockquote {
+ background: transparent;
+ border-top-color: rgba(255, 255, 255, 0.14);
+ border-bottom-color: rgba(255, 255, 255, 0.14);
+}
+
+/* 7. Emphasis style: Marker underline & warm yellow highlight ("marker") */
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror blockquote strong,
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror blockquote b,
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content blockquote strong,
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content blockquote b {
+ border-bottom: 3px solid #fde68a;
+ padding-bottom: 2px;
+}
+
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror :is(p, li) > :is(strong, b),
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content :is(p, li) > :is(strong, b) {
+ border-bottom: 2px solid var(--note-palette-divider, #d1d5db);
+ padding-bottom: 1px;
+}
+
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror blockquote :is(p, li) > :is(strong, b),
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content blockquote :is(p, li) > :is(strong, b) {
+ border-bottom: 3px solid #fde68a;
+ padding-bottom: 2px;
+}
+
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror u,
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content u {
+ text-decoration: none;
+ border-bottom: 2px solid var(--note-palette-divider, #d1d5db);
+ padding-bottom: 1px;
+ font-weight: 600;
+}
+
+:root.dark .edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror u,
+:root.dark .edgeever-editor[data-note-emphasis-style="marker"] .markdown-content u,
+:root.dark .edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror :is(p, li) > :is(strong, b),
+:root.dark .edgeever-editor[data-note-emphasis-style="marker"] .markdown-content :is(p, li) > :is(strong, b) {
+ border-bottom-color: color-mix(in srgb, var(--note-palette-accent, #9ca3af) 55%, transparent);
+}
+
+.edgeever-editor[data-note-emphasis-style="marker"] .ProseMirror mark,
+.edgeever-editor[data-note-emphasis-style="marker"] .markdown-content mark {
+ background-color: #fde68a;
+ color: #111827;
+ padding: 1px 4px;
+ border-radius: 2px;
+ font-weight: 600;
+}
diff --git a/apps/web/src/styles/note-prose.css b/apps/web/src/styles/note-prose.css
index 1cec1c45..042fc4b4 100644
--- a/apps/web/src/styles/note-prose.css
+++ b/apps/web/src/styles/note-prose.css
@@ -38,12 +38,28 @@
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror th,
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content th {
- background: var(--note-palette-surface);
+ background: var(--note-palette-accent);
+ color: #ffffff;
+ font-weight: 700;
+}
+
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror th strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror th b,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content th strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content th b {
+ color: #ffffff;
+}
+
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror td strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror td b,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content td strong,
+.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content td b {
+ color: #111827;
}
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror tbody tr:nth-child(even) td,
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content tbody tr:nth-child(even) td {
- background: color-mix(in srgb, var(--note-palette-surface) 60%, transparent);
+ background: #f9fafb;
}
.edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror tbody tr:hover td,
@@ -80,12 +96,20 @@
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror th,
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content th {
- background: color-mix(in srgb, var(--note-palette-accent) 12%, transparent);
+ background: color-mix(in srgb, var(--note-palette-accent) 68%, #1e293b);
+ color: #ffffff;
+}
+
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror td strong,
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror td b,
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content td strong,
+:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content td b {
+ color: #f3f4f6;
}
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror tbody tr:nth-child(even) td,
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .markdown-content tbody tr:nth-child(even) td {
- background: color-mix(in srgb, var(--note-palette-accent) 4.5%, transparent);
+ background: rgba(255, 255, 255, 0.03);
}
:root.dark .edgeever-editor[data-note-palette]:not([data-note-palette="native"]) .ProseMirror tbody tr:hover td,
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index a28c810d..90674b59 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -1182,12 +1182,32 @@ export const enUS = {
native: "Native",
clay: "Vermilion orange",
dawn: "Ochre gold",
+ emerald: "Emerald",
teal: "Jade teal",
azure: "Royal blue",
violet: "Iris purple",
pink: "Rose pink",
slate: "Mauve gray",
},
+ editorBodyHeadingStyleTitle: "Heading style",
+ editorBodyHeadingStyles: {
+ default: "Default",
+ bar: "Left bar",
+ numbered: "Numbered sections",
+ underline: "Bottom rule",
+ },
+ editorBodyQuoteStyleTitle: "Quote style",
+ editorBodyQuoteStyles: {
+ default: "Default",
+ dashed: "Dashed card",
+ "accent-bar": "Accent bar",
+ "minimal-rule": "Minimal rule",
+ },
+ editorBodyEmphasisStyleTitle: "Underline & highlight",
+ editorBodyEmphasisStyles: {
+ default: "Default",
+ marker: "Marker underline",
+ },
editorBodyCssTitle: "Custom CSS",
editorBodyCssDescription: "One stylesheet. Light rules set spacing and color, and the following :root.dark rules only override color. Size and line height stay on the controls above.",
editorBodyCssPreviewLabel: "Preview",
diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.ts
index aef27059..c15ab1ba 100644
--- a/packages/shared/src/i18n/ja.ts
+++ b/packages/shared/src/i18n/ja.ts
@@ -1171,12 +1171,32 @@ export const ja = {
native: "標準",
clay: "朱橙",
dawn: "オーカーゴールド",
+ emerald: "翡翠",
teal: "ジェイドティール",
azure: "ロイヤルブルー",
violet: "アイリスパープル",
pink: "ローズピンク",
slate: "モーヴグレー",
},
+ editorBodyHeadingStyleTitle: "見出しスタイル",
+ editorBodyHeadingStyles: {
+ default: "標準",
+ bar: "左バー",
+ numbered: "番号付きセクション",
+ underline: "下線区切り",
+ },
+ editorBodyQuoteStyleTitle: "引用スタイル",
+ editorBodyQuoteStyles: {
+ default: "標準",
+ dashed: "破線カード",
+ "accent-bar": "アクセント左線",
+ "minimal-rule": "ミニマル細線",
+ },
+ editorBodyEmphasisStyleTitle: "下線とハイライト",
+ editorBodyEmphasisStyles: {
+ default: "標準",
+ marker: "蛍光アンダーライン",
+ },
editorBodyCssTitle: "カスタム CSS",
editorBodyCssDescription: "スタイルは1つです。ライトで間隔と色を書き、直後の :root.dark は色だけを上書きします。文字サイズと行間はここでは指定しません。",
editorBodyCssPreviewLabel: "プレビュー",
diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.ts
index c711bf11..e1afc65d 100644
--- a/packages/shared/src/i18n/pl.ts
+++ b/packages/shared/src/i18n/pl.ts
@@ -1171,12 +1171,32 @@ export const pl = {
native: "Natywne",
clay: "Cynobrowy pomarańcz",
dawn: "Ochrowe złoto",
+ emerald: "Szmaragdowy",
teal: "Jadeitowy turkus",
azure: "Królewski błękit",
violet: "Irysowy fiolet",
pink: "Różany róż",
slate: "Szarość z fioletem",
},
+ editorBodyHeadingStyleTitle: "Styl nagłówków",
+ editorBodyHeadingStyles: {
+ default: "Domyślny",
+ bar: "Pasek z lewej",
+ numbered: "Numerowane sekcje",
+ underline: "Linia dolna",
+ },
+ editorBodyQuoteStyleTitle: "Styl cytatów",
+ editorBodyQuoteStyles: {
+ default: "Domyślny",
+ dashed: "Karta z przerywaną ramką",
+ "accent-bar": "Pasek akcentu",
+ "minimal-rule": "Minimalna linia",
+ },
+ editorBodyEmphasisStyleTitle: "Podkreślenie i wyróżnienie",
+ editorBodyEmphasisStyles: {
+ default: "Domyślny",
+ marker: "Zakreślacz pod tekstem",
+ },
editorBodyCssTitle: "Własny CSS",
editorBodyCssDescription: "Jeden arkusz stylów. Reguły jasne ustawiają odstępy i kolory, a następujące po nich reguły :root.dark nadpisują tylko kolory. Rozmiar i interlinia pozostają w ustawieniach powyżej.",
editorBodyCssPreviewLabel: "Podgląd",
diff --git a/packages/shared/src/i18n/ru.ts b/packages/shared/src/i18n/ru.ts
index e0a63ccc..9ce35ad4 100644
--- a/packages/shared/src/i18n/ru.ts
+++ b/packages/shared/src/i18n/ru.ts
@@ -1182,12 +1182,32 @@ export const ru = {
native: "Системная",
clay: "Красный",
dawn: "Золотой",
+ emerald: "Изумрудный",
teal: "Бирюзовый",
azure: "Синий",
violet: "Фиолетовый",
pink: "Розовый",
slate: "Серый",
},
+ editorBodyHeadingStyleTitle: "Стиль заголовков",
+ editorBodyHeadingStyles: {
+ default: "По умолчанию",
+ bar: "Полоса слева",
+ numbered: "Нумерованные разделы",
+ underline: "Нижняя линия",
+ },
+ editorBodyQuoteStyleTitle: "Стиль цитат",
+ editorBodyQuoteStyles: {
+ default: "По умолчанию",
+ dashed: "Пунктирная карточка",
+ "accent-bar": "Акцентная линия",
+ "minimal-rule": "Тонкие линии",
+ },
+ editorBodyEmphasisStyleTitle: "Подчёркивание и выделение",
+ editorBodyEmphasisStyles: {
+ default: "По умолчанию",
+ marker: "Маркерное подчёркивание",
+ },
editorBodyCssTitle: "Свой CSS",
editorBodyCssDescription: "Для светлой и тёмной темы — свои правила. Размер и высота строки задаются элементами управления выше.",
editorBodyCssPreviewLabel: "Просмотр",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index d198d4b7..c6765318 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -1182,12 +1182,32 @@ export const zhCN = {
native: "原生",
clay: "朱橙",
dawn: "赭金",
+ emerald: "翡翠",
teal: "碧青",
azure: "宝蓝",
violet: "鸢紫",
pink: "玫粉",
slate: "灰紫",
},
+ editorBodyHeadingStyleTitle: "标题样式",
+ editorBodyHeadingStyles: {
+ default: "默认",
+ bar: "左竖条",
+ numbered: "编号章节",
+ underline: "底线分割",
+ },
+ editorBodyQuoteStyleTitle: "引用样式",
+ editorBodyQuoteStyles: {
+ default: "默认",
+ dashed: "虚线卡片",
+ "accent-bar": "强调左线",
+ "minimal-rule": "极简细线",
+ },
+ editorBodyEmphasisStyleTitle: "下划线与高亮",
+ editorBodyEmphasisStyles: {
+ default: "默认",
+ marker: "荧光底边",
+ },
editorBodyCssTitle: "自定义 CSS",
editorBodyCssDescription: "同一份样式。浅色写间距和颜色,紧随的 :root.dark 只覆盖颜色。字号和行高不写在这里。",
editorBodyCssPreviewLabel: "预览",
diff --git a/packages/shared/src/note-prose.test.mjs b/packages/shared/src/note-prose.test.mjs
index 84c3628a..b7b91292 100644
--- a/packages/shared/src/note-prose.test.mjs
+++ b/packages/shared/src/note-prose.test.mjs
@@ -4,6 +4,9 @@ import {
NOTE_PROSE_PALETTES,
NOTE_PROSE_PALETTE_CHOICES,
NOTE_PROSE_DARK_ACCENTS,
+ NOTE_PROSE_HEADING_STYLES,
+ NOTE_PROSE_QUOTE_STYLES,
+ NOTE_PROSE_EMPHASIS_STYLES,
accountNoteProseFromRow,
publicNoteProseFromAccount,
noteProseCssVariables,
@@ -12,6 +15,9 @@ import {
noteProseMigrationPatch,
paletteForLegacyEditorTheme,
parseNoteProsePalette,
+ parseNoteProseHeadingStyle,
+ parseNoteProseQuoteStyle,
+ parseNoteProseEmphasisStyle,
resolveNoteProse,
DEFAULT_NOTE_PROSE_CSS,
noteProseCssDropsDeclarations,
@@ -56,7 +62,7 @@ describe("note prose", () => {
for (const [id, colors] of Object.entries(NOTE_PROSE_PALETTES)) {
for (const background of ["#FFFFFF", "#F8FAFB"]) {
// Bright emphasis is intentional; links and code retain normal-text AA.
- const minimumAccentContrast = id === "teal" ? 2.5 : id === "clay" ? 3 : 4.5;
+ const minimumAccentContrast = id === "teal" ? 2.5 : id === "clay" || id === "emerald" ? 3 : 4.5;
expect(contrast(colors.accent, background)).toBeGreaterThanOrEqual(minimumAccentContrast);
for (const foreground of [colors.link, colors.codeText]) {
expect(contrast(foreground, background)).toBeGreaterThanOrEqual(4.5);
@@ -82,12 +88,22 @@ describe("note prose", () => {
expect(paletteForLegacyEditorTheme("outline-emerald")).toBeNull();
expect(paletteForLegacyEditorTheme("wechat-green")).toBeNull();
expect(paletteForLegacyEditorTheme("modern-mint")).toBeNull();
- expect(parseNoteProsePalette("emerald")).toBe("native");
+ expect(parseNoteProsePalette("emerald")).toBe("emerald");
+ expect(NoteProseUpdateSchema.safeParse({ palette: "emerald" }).success).toBe(true);
expect(parseNoteProsePalette("green")).toBe("native");
expect(NoteProseUpdateSchema.safeParse({ palette: "green" }).success).toBe(false);
expect(parseNoteProsePalette("plum")).toBe("native");
expect(NoteProseUpdateSchema.safeParse({ palette: "plum" }).success).toBe(false);
- expect(resolveNoteProse({ palette: "emerald" }).palette).toBe("native");
+ expect(resolveNoteProse({ palette: "emerald" }).palette).toBe("emerald");
+ expect(NOTE_PROSE_HEADING_STYLES).toEqual(["default", "bar", "numbered", "underline"]);
+ expect(NOTE_PROSE_QUOTE_STYLES).toEqual(["default", "dashed", "accent-bar", "minimal-rule"]);
+ expect(NOTE_PROSE_EMPHASIS_STYLES).toEqual(["default", "marker"]);
+ expect(parseNoteProseHeadingStyle("numbered")).toBe("numbered");
+ expect(parseNoteProseHeadingStyle("unknown")).toBeNull();
+ expect(parseNoteProseQuoteStyle("dashed")).toBe("dashed");
+ expect(parseNoteProseQuoteStyle("unknown")).toBeNull();
+ expect(parseNoteProseEmphasisStyle("marker")).toBe("marker");
+ expect(parseNoteProseEmphasisStyle("unknown")).toBeNull();
expect(paletteForLegacyEditorTheme("brief")).toBe("teal");
expect(paletteForLegacyEditorTheme("zen")).toBe("teal");
expect(paletteForLegacyEditorTheme("guide")).toBe("azure");
diff --git a/packages/shared/src/note-prose.ts b/packages/shared/src/note-prose.ts
index 4bc4d084..de57668f 100644
--- a/packages/shared/src/note-prose.ts
+++ b/packages/shared/src/note-prose.ts
@@ -9,6 +9,7 @@ export const DEFAULT_NOTE_PROSE_LINE_HEIGHT: NoteProseLineHeight = 1.65;
export const NOTE_PROSE_PALETTE_IDS = [
"clay",
"dawn",
+ "emerald",
"teal",
"azure",
"violet",
@@ -20,6 +21,37 @@ export type NoteProsePaletteId = (typeof NOTE_PROSE_PALETTE_IDS)[number];
export const NOTE_PROSE_PALETTE_CHOICES = ["native", ...NOTE_PROSE_PALETTE_IDS] as const;
export type NoteProsePaletteChoice = (typeof NOTE_PROSE_PALETTE_CHOICES)[number];
+export const NOTE_PROSE_HEADING_STYLES = [
+ "default",
+ "bar",
+ "numbered",
+ "underline",
+] as const;
+export type NoteProseHeadingStyle = (typeof NOTE_PROSE_HEADING_STYLES)[number];
+export const DEFAULT_NOTE_PROSE_HEADING_STYLE: NoteProseHeadingStyle = "default";
+
+export const NOTE_PROSE_QUOTE_STYLES = [
+ "default",
+ "dashed",
+ "accent-bar",
+ "minimal-rule",
+] as const;
+export type NoteProseQuoteStyle = (typeof NOTE_PROSE_QUOTE_STYLES)[number];
+export const DEFAULT_NOTE_PROSE_QUOTE_STYLE: NoteProseQuoteStyle = "default";
+
+export const NOTE_PROSE_EMPHASIS_STYLES = [
+ "default",
+ "marker",
+] as const;
+export type NoteProseEmphasisStyle = (typeof NOTE_PROSE_EMPHASIS_STYLES)[number];
+export const DEFAULT_NOTE_PROSE_EMPHASIS_STYLE: NoteProseEmphasisStyle = "default";
+
+export type NoteProseStylePreferences = {
+ headingStyle: NoteProseHeadingStyle;
+ quoteStyle: NoteProseQuoteStyle;
+ emphasisStyle: NoteProseEmphasisStyle;
+};
+
export const MAX_NOTE_PROSE_CSS_BYTES = 8 * 1024;
export const NOTE_PROSE_PARAGRAPH_SPACING_PX = 8;
@@ -130,6 +162,17 @@ export const NOTE_PROSE_PALETTES: Record<NoteProsePaletteId, NoteProsePaletteCol
codeText: "#7C5500",
background: "#FFFFFF",
}),
+ emerald: palette({
+ accent: "#059669",
+ text: "#374151",
+ muted: "#4B5563",
+ surface: "#F0FDF4",
+ divider: "#A7F3D0",
+ link: "#047857",
+ codeBackground: "#ECFDF5",
+ codeText: "#047857",
+ background: "#FFFFFF",
+ }),
teal: palette({
accent: "#20AD9D",
text: "#3E4C4A",
@@ -191,6 +234,7 @@ export const NOTE_PROSE_PALETTES: Record<NoteProsePaletteId, NoteProsePaletteCol
export const NOTE_PROSE_DARK_ACCENTS: Record<NoteProsePaletteId, string> = {
clay: "#FF996E",
dawn: "#D9B65C",
+ emerald: "#6EE7B7",
teal: "#70C7B8",
azure: "#8CB4F0",
violet: "#B39AE8",
@@ -252,12 +296,27 @@ export const parseNoteProsePalette = (value: unknown): NoteProsePaletteChoice |
// Red and orange now share the existing red identifier for older clients.
if (value === "orange") return "clay";
// Removed palettes and the custom color editor read as native.
- if (value === "emerald" || value === "green" || value === "plum" || value === "custom") return "native";
+ if (value === "green" || value === "plum" || value === "custom") return "native";
return typeof value === "string" && (NOTE_PROSE_PALETTE_CHOICES as readonly string[]).includes(value)
? value as NoteProsePaletteChoice
: null;
};
+export const parseNoteProseHeadingStyle = (value: unknown): NoteProseHeadingStyle | null =>
+ typeof value === "string" && (NOTE_PROSE_HEADING_STYLES as readonly string[]).includes(value)
+ ? value as NoteProseHeadingStyle
+ : null;
+
+export const parseNoteProseQuoteStyle = (value: unknown): NoteProseQuoteStyle | null =>
+ typeof value === "string" && (NOTE_PROSE_QUOTE_STYLES as readonly string[]).includes(value)
+ ? value as NoteProseQuoteStyle
+ : null;
+
+export const parseNoteProseEmphasisStyle = (value: unknown): NoteProseEmphasisStyle | null =>
+ typeof value === "string" && (NOTE_PROSE_EMPHASIS_STYLES as readonly string[]).includes(value)
+ ? value as NoteProseEmphasisStyle
+ : null;
+
const isColorSet = (value: unknown): value is NoteProseCustomColorSet => {
if (typeof value !== "object" || value === null) return false;
const record = value as Record<string, unknown>;