Skip to content

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

feat: render Evernote guide dynamically from root docs/evernote-migration-guide.md

tianmaeb1b79050460
diff --git a/apps/web/src/components/EvernoteImportGuidePane.tsx b/apps/web/src/components/EvernoteImportGuidePane.tsx
index 09ac1e25..84facd22 100644
--- a/apps/web/src/components/EvernoteImportGuidePane.tsx
+++ b/apps/web/src/components/EvernoteImportGuidePane.tsx
@@ -1,119 +1,45 @@
-import { ChevronLeft, Download, HelpCircle, UploadCloud } from "lucide-react";
-import type { ReactNode } from "react";
+import { ChevronLeft, HelpCircle } from "lucide-react";
import { Button } from "@/components/ui/button";
-import { EVERNOTE_MIGRATION_GUIDE, type MigrationGuideStep } from "@/lib/evernote-migration-guide";
+import { marked } from "marked";
+import migrationGuideMarkdown from "../../../../docs/evernote-migration-guide.md?raw";
-export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) => (
- <div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
- <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 bg-white px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:px-6 lg:pb-0 lg:pt-0">
- <div className="flex min-w-0 items-center gap-3">
- <Button
- size="icon"
- variant="ghost"
- title="返回"
- aria-label="返回"
- onClick={onClose}
- className="h-9 w-9 rounded-lg hover:bg-slate-100"
- >
- <ChevronLeft className="h-5 w-5 text-slate-500" />
- </Button>
- <div className="min-w-0">
- <h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
- <HelpCircle className="h-4 w-4 text-emerald-700" />
- {EVERNOTE_MIGRATION_GUIDE.title}
- </h1>
- <p className="mt-0.5 truncate text-xs font-medium text-slate-400">{EVERNOTE_MIGRATION_GUIDE.subtitle}</p>
- </div>
- </div>
- </header>
+export const EvernoteImportGuidePane = ({ onClose }: { onClose: () => void }) => {
+ const htmlContent = marked.parse(migrationGuideMarkdown) as string;
- <main className="min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-4 lg:px-6 lg:py-6">
- <article className="mx-auto grid w-full min-w-0 max-w-4xl gap-4">
- <section className="rounded-lg border border-emerald-100 bg-white p-5 shadow-none">
- <h2 className="text-lg font-bold text-slate-950">{EVERNOTE_MIGRATION_GUIDE.introTitle}</h2>
- {EVERNOTE_MIGRATION_GUIDE.intro.map((paragraph) => (
- <p key={paragraph} className="mt-3 text-sm leading-6 text-slate-600">
- {paragraph}
+ return (
+ <div className="flex h-full min-h-0 min-w-0 flex-col overflow-x-hidden bg-slate-50">
+ <header className="flex h-[calc(3.5rem+env(safe-area-inset-top))] shrink-0 items-end justify-between border-b border-slate-200 bg-white px-4 pb-3 pt-[env(safe-area-inset-top)] lg:h-16 lg:items-center lg:px-6 lg:pb-0 lg:pt-0">
+ <div className="flex min-w-0 items-center gap-3">
+ <Button
+ size="icon"
+ variant="ghost"
+ title="返回"
+ aria-label="返回"
+ onClick={onClose}
+ className="h-9 w-9 rounded-lg hover:bg-slate-100"
+ >
+ <ChevronLeft className="h-5 w-5 text-slate-500" />
+ </Button>
+ <div className="min-w-0">
+ <h1 className="flex items-center gap-2 text-base font-bold leading-tight text-slate-900">
+ <HelpCircle className="h-4 w-4 text-emerald-700" />
+ 印象笔记迁移指引
+ </h1>
+ <p className="mt-0.5 truncate text-xs font-medium text-slate-400">
+ AI Agent 驱动一键迁移,无损保留笔记本组结构
</p>
- ))}
- </section>
-
- {EVERNOTE_MIGRATION_GUIDE.steps.map((step) => (
- <GuideStep key={`${step.index}-${step.title}`} step={step} />
- ))}
- </article>
- </main>
- </div>
-);
-
-const GuideStep = ({ step }: { step: MigrationGuideStep }) => (
- <section className="rounded-lg border border-slate-200 bg-white p-5 text-sm leading-6 text-slate-700 shadow-none">
- <div className="mb-3 flex items-center gap-3">
- <div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-50 text-emerald-700">
- {getStepIcon(step.index)}
- </div>
- <div className="min-w-0">
- <div className="text-xs font-bold text-slate-400">步骤 {step.index}</div>
- <h2 className="text-base font-bold text-slate-950">{step.title}</h2>
- </div>
- </div>
- <div className="space-y-3">
- {step.paragraphs?.map((paragraph) => (
- <p key={paragraph}>
- <RichText text={paragraph} />
- </p>
- ))}
-
- {step.commands?.map((command) => (
- <div key={`${command.label}-${command.code}`} className="space-y-2">
- <div className="text-sm font-bold text-slate-900">{command.label}</div>
- <GuideCode>{command.code}</GuideCode>
+ </div>
</div>
- ))}
-
- {step.list && (
- <ul className="list-disc space-y-1 pl-5">
- {step.list.map((item) => (
- <li key={item}>
- <RichText text={item} />
- </li>
- ))}
- </ul>
- )}
+ </header>
+
+ <main className="min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-4 lg:px-6 lg:py-6">
+ <article className="mx-auto w-full min-w-0 max-w-4xl rounded-lg border border-slate-200 bg-white p-6 shadow-sm">
+ <div
+ className="prose prose-slate max-w-none text-sm leading-6 text-slate-700 dark:prose-invert prose-headings:font-bold prose-a:text-emerald-700"
+ dangerouslySetInnerHTML={{ __html: htmlContent }}
+ />
+ </article>
+ </main>
</div>
- </section>
-);
-
-const GuideCode = ({ children }: { children: string }) => (
- <pre className="overflow-x-auto rounded-md border border-slate-100 bg-slate-950 p-3 text-xs leading-5 text-slate-100">
- <code>{children}</code>
- </pre>
-);
-
-const RichText = ({ text }: { text: string }) => {
- const pieces = text.split(/(`[^`]+`)/g);
-
- return (
- <>
- {pieces.map((piece, index) =>
- piece.startsWith("`") && piece.endsWith("`") ? (
- <code key={`${piece}-${index}`}>{piece.slice(1, -1)}</code>
- ) : (
- <span key={`${piece}-${index}`}>{piece}</span>
- )
- )}
- </>
);
};
-
-const getStepIcon = (index: string): ReactNode => {
- if (index === "1" || index === "1.1") {
- return <Download className="h-4 w-4" />;
- }
-
- if (index === "2" || index === "3" || index === "4") {
- return <UploadCloud className="h-4 w-4" />;
- }
-
- return <HelpCircle className="h-4 w-4" />;
-};
diff --git a/apps/web/src/lib/evernote-migration-guide.ts b/apps/web/src/lib/evernote-migration-guide.ts
deleted file mode 100644
index c4d1ee35..00000000
--- a/apps/web/src/lib/evernote-migration-guide.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-export type MigrationGuideCommand = {
- label: string;
- language: "sh" | "powershell";
- code: string;
-};
-
-export type MigrationGuideStep = {
- index: string;
- title: string;
- paragraphs?: string[];
- commands?: MigrationGuideCommand[];
- list?: string[];
-};
-
-export const EVERNOTE_MIGRATION_GUIDE = {
- title: "印象笔记迁移指引",
- subtitle: "支持 AI Agent 一键驱动或 MCP 自动化批量导入,保留笔记本组结构",
- introTitle: "最佳实践迁移方案",
- intro: [
- "我们强烈推荐使用 AI 编程助手(如 Antigravity、Claude Code、Cursor 等)自动执行迁移,或者基于 EdgeEver MCP (Model Context Protocol) 命令行进行迁移。该方案已完成内存流式优化与空文本预处理,能安全应对数 GB 级别超大笔记库,完整保留创建/修改时间与嵌套笔记本目录层级。",
- ],
- steps: [
- {
- index: "1",
- title: "第一步:配置并安装 EdgeEver MCP 服务",
- list: [
- "点击网页端左下角的「设置(Settings)」图标。",
- "在「API & MCP 授权」卡片生成 Token 后,点击「复制完整 MCP 配置」按钮。",
- "把复制的 JSON 配置直接粘贴发送给你的 AI 编程助手(如 Antigravity, Claude Code, Cursor 等),让它帮你自动在当前的 AI 客户端中安装配置好该 MCP 服务。",
- ],
- commands: [
- {
- label: "发送给 AI 助手的配置安装 Prompt",
- language: "sh",
- code: `你是 AI 编程助手。这是我的 EdgeEver MCP 服务配置 JSON。请帮我把这个 MCP 服务直接安装配置到我当前使用的 AI 编辑器/客户端(如 Claude Code, Cursor, Cline 等)的 MCP 服务器配置文件中:
-
-<在此处粘贴刚才复制的 JSON 配置内容>`,
- },
- ],
- },
- {
- index: "2",
- title: "第二步:让 AI 助手自动导入和迁移笔记",
- paragraphs: [
- "当 AI 助手配置好 MCP 之后,请复制以下 Prompt 发送给它,让它全自动拉取印象笔记数据并导入(你可以指定只同步部分笔记本,或者进行全量导入):",
- ],
- commands: [
- {
- label: "发送给 AI 助手的迁移同步 Prompt",
- language: "sh",
- code: `你是 AI 编程助手。请帮我基于 \`evernote-backup\` 工具和刚安装的 EdgeEver MCP 服务,把我的本地印象笔记数据同步迁移到实例中:
-1. 检查本地是否安装了 \`evernote-backup\`。若未安装,请使用 \`pipx install evernote-backup\` 自动安装。
-2. 确保项目根目录下已安装本地图片压缩库 \`sharp\`(未安装请运行 \`bun install\`)。
-3. 提示我输入印象笔记用户名密码并初始化数据库(指定 china 后端),随后同步数据并导出到 \`./evernote-export\` 目录。
-4. 运行内置的导入脚本完成迁移。脚本会自动利用本地 \`sharp\` 库将图片进行 2560px 等比压缩并转为 WebP 格式再上传,以此避免触发 Cloudflare 限额:
- - 全量迁移运行:\`bun scripts/import-evernote-enex-via-mcp.mjs --input "./evernote-export" --yes\`
- - 若要指定只迁移某几个笔记本,请在命令后加上 \`--include "笔记本A,笔记本B"\` 参数。
-
-请告诉我你需要什么信息(如账号密码),收到后直接并发自动执行上述步骤。`,
- },
- ],
- },
- {
- index: "3",
- title: "第三步:在网页端验证结果",
- list: [
- "导入完成后,回到 EdgeEver 网页端刷新页面。",
- "检查左侧栏,确认印象笔记原有的「笔记本组(堆叠)」层级结构已完美还原。",
- "打开几篇包含多张图片的笔记,验证其中的图片是否已成功在编辑器中加载并能清晰显示。",
- "验证完毕后,你可以随时在「设置」->「API & MCP 授权」中吊销此 Token 以保障安全。",
- ],
- },
- ] satisfies MigrationGuideStep[],
-};
diff --git a/bun.lock b/bun.lock
index 1556aff2..9b51be6d 100644
--- a/bun.lock
+++ b/bun.lock
@@ -28,6 +28,7 @@
"fast-xml-parser": "^5.9.3",
"hono": "latest",
"lucide-react": "latest",
+ "marked": "^18.0.5",
"react": "latest",
"react-dom": "latest",
"react-router": "^8.1.0",
@@ -41,6 +42,7 @@
},
"devDependencies": {
"@cloudflare/workers-types": "latest",
+ "@types/marked": "^6.0.0",
"@types/node": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",
@@ -676,6 +678,8 @@
"@types/estree": ["@types/[email protected]", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
+ "@types/marked": ["@types/[email protected]", "", { "dependencies": { "marked": "*" } }, "sha512-jmjpa4BwUsmhxcfsgUit/7A9KbrC48Q0q8KvnY107ogcjGgTFDlIL3RpihNpx2Mu1hM4mdFQjoVc4O6JoGKHsA=="],
+
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-fc3KiUoBt6kie0N9bIW3E47vZsuaMf0PM2AaUpLCLT0s/LvX1nxAim6Fc049cNxODPpGm6qRAuUOB86SkRuPQw=="],
"@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw=="],
@@ -1062,6 +1066,8 @@
"magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
+ "marked": ["[email protected]", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-S6GcvALHg6K4ohtu4E7x0a1AqhAjp6cV8KhLSyN9qVapnzJkusVBxZRcIU9AeYsbe6P1hKDusSbEOzGyyuce6w=="],
+
"math-intrinsics": ["[email protected]", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
"merge2": ["[email protected]", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],
diff --git a/docs/evernote-migration-guide.md b/docs/evernote-migration-guide.md
new file mode 100644
index 00000000..8eaf7acd
--- /dev/null
+++ b/docs/evernote-migration-guide.md
@@ -0,0 +1,46 @@
+# 印象笔记(Evernote)极简迁移指引
+
+我们强烈推荐使用 AI 编程助手(如 Antigravity、Claude Code、Cursor 等)自动执行迁移。该方案已完成内存流式优化与空文本预处理,能安全应对数 GB 级别超大笔记库,完整保留创建/修改时间与嵌套笔记本目录层级。
+
+---
+
+### 步骤 1:配置并安装 EdgeEver MCP 服务
+
+1. 点击网页端左下角的 **设置(Settings)** 图标。
+2. 在 **API & MCP 授权** 卡片生成 Token 后,点击 **复制完整 MCP 配置** 按钮。
+3. 把复制的 JSON 配置直接粘贴发送给你的 AI 编程助手(如 Antigravity, Claude Code, Cursor 等),让它帮你自动在当前的 AI 客户端中安装配置好该 MCP 服务:
+
+```sh
+你是 AI 编程助手。这是我的 EdgeEver MCP 服务配置 JSON。请帮我把这个 MCP 服务直接配置到我当前使用的 AI 编辑器/客户端(如 Claude Code, Cursor, Cline 等)的 MCP 服务器配置文件中:
+
+<在此处粘贴刚才复制 of JSON 配置内容>
+```
+
+---
+
+### 步骤 2:让 AI 助手自动导入和迁移笔记
+
+当 AI 助手配置好 MCP 之后,请复制以下 Prompt 发送给它,让它全自动拉取印象笔记数据并导入:
+
+```sh
+你是 AI 编程助手。请帮我基于 evernote-backup 工具和刚安装的 EdgeEver MCP 服务,把我的本地印象笔记数据同步迁移到实例中:
+1. 检查本地是否安装了 evernote-backup。若未安装,请使用 pipx install evernote-backup 自动安装。
+2. 确保项目根目录下已安装本地图片压缩库 sharp(未安装请运行 bun install)。
+3. 提示我输入印象笔记用户名密码并初始化数据库(指定 china 后端),随后同步数据并导出到 ./evernote-export 目录。
+4. 运行内置的导入脚本完成迁移。脚本会自动利用本地 sharp 库将图片进行 2560px 等比压缩并转为 WebP 格式再上传,以此避免触发 Cloudflare 限额:
+ - 全量迁移运行:bun scripts/import-evernote-enex-via-mcp.mjs --input "./evernote-export" --yes
+ - 若要指定只迁移某几个笔记本,请在命令后加上 --include "笔记本A,笔记本B" 参数。
+
+请告诉我你需要什么信息(如账号密码),收到后直接并发自动执行上述步骤。
+```
+
+> 💡 **手动模式备用**:如果您不使用 AI 助手,具体执行命令在根目录 `scripts/import-evernote-enex-via-mcp.mjs` 的头部注释中有详细引导。
+
+---
+
+### 步骤 3:在网页端验证结果
+
+1. 导入完成后,回到 EdgeEver 网页端刷新页面。
+2. 检查左侧栏,确认印象笔记原有的「笔记本组(堆叠)」层级结构已完美还原。
+3. 打开几篇包含多张图片的笔记,验证其中的图片是否已成功在编辑器中加载并能清晰显示。
+4. 验证完毕后,你可以随时在 **设置** -> **API & MCP 授权** 中吊销此 Token 以保障安全。
diff --git a/package.json b/package.json
index 9f3706b6..50a5d60a 100644
--- a/package.json
+++ b/package.json
@@ -59,6 +59,7 @@
"fast-xml-parser": "^5.9.3",
"hono": "latest",
"lucide-react": "latest",
+ "marked": "^18.0.5",
"react": "latest",
"react-dom": "latest",
"react-router": "^8.1.0",
@@ -72,6 +73,7 @@
},
"devDependencies": {
"@cloudflare/workers-types": "latest",
+ "@types/marked": "^6.0.0",
"@types/node": "latest",
"@types/react": "latest",
"@types/react-dom": "latest",