finch-markdown-editor 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,43 +1,69 @@
1
- # Markdown Editor
1
+ # 写字 (Writing)
2
2
 
3
- A focused Markdown editor for Finch with WeChat Official Account preview, selection-based AI edits, and AI-designed custom styles.
3
+ 一款为码字工作者打造的 Markdown 写作小程序:本地文件直接编辑、微信风格排版预览、专注模式、AI 批注改写,全部在你自己的机器上完成。
4
4
 
5
- ## Use it
5
+ ---
6
+
7
+ ## 它解决什么问题
8
+
9
+ 写长文最怕三件事:
6
10
 
7
- 1. Open **Markdown Editor** from Finch's right Panel and click the **folder** icon to open a `.md` file.
8
- 2. Edit Markdown directly. Use the **save** button or `Cmd/Ctrl+S` to write changes to disk; external file changes refresh automatically.
9
- 3. Click the **toggle** button to switch to the WeChat preview. Choose one of bm.md's 8 built-in styles from the **palette** menu.
10
- 4. Select text in the editor or preview, describe the desired revision in the popup, and add it to the Finch Composer as precise AI context.
11
- 5. Click the **wand** icon to ask Finch AI to design custom CSS based on the bm.md output structure.
12
- 6. Use **Copy HTML** to copy inline-styled rich text for the WeChat editor.
11
+ 1. **一边写一边想排版**,思绪被打断;
12
+ 2. **改一个段落要复制粘贴来回倒腾**,还容易弄丢草稿;
13
+ 3. **写完发公众号才发现格式不对**,返工重排。
13
14
 
14
- ## Architecture
15
+ 「写字」把这三件事合到了一起:Markdown 就是你的源文件,预览即所得,AI 帮你改稿,草稿永不丢。
15
16
 
16
- The Markdown editor is implemented by this mini tool with CodeMirror 6, not by bm.md. CodeMirror owns Markdown parsing, syntax highlighting, line wrapping, selections, active-line rendering, undo history, and keyboard editing. The Panel integration owns file I/O, selection annotations, save state, toolbar interactions, and preview presentation.
17
+ ---
18
+
19
+ ## 快速上手
17
20
 
18
- bm.md is only the rendering engine. The mini tool installs the `bmmd` CLI once into its private storage, then sends the current Markdown to `bmmd render --platform wechat`. The returned inline-styled HTML is displayed in a sandboxed iframe. Article content stays local and no long-running bm.md web service is used.
21
+ 1. Finch 右侧面板打开 **写字**。
22
+ 2. 点击工具栏「文件夹」图标选择一篇 `.md` 文件(或直接新建一篇)。
23
+ 3. 开始写。写的过程中随时:
19
24
 
20
- The mini tool is MIT licensed. bm.md / `bmmd` is AGPL-3.0 and is installed separately at runtime rather than bundled into this package.
25
+ | 想做的事 | 怎么操作 |
26
+ |---|---|
27
+ | 打开/新建文档 | 工具栏「文件夹」/ 首页「新建文档」 |
28
+ | 保存 | `Cmd/Ctrl + S`(改动会自动落盘,不用惦记) |
29
+ | 切换公众号预览 | 工具栏「预览」按钮,所见即所得 |
30
+ | 让 AI 改一段话 | 框选文字 → 描述要求 → 加入对话 |
31
+ | 专注不被打扰 | 工具栏「专注」(羽毛图标),当前行居中、其余行变淡 |
32
+ | 行距宽松点写 | 字体菜单 → 舒适(紧凑/舒适两档) |
33
+ | 排版风格 | 预览模式下点「调色板」,8 种内置风格任选 |
34
+ | 自定义 AI 排版 | 预览浮层「让 AI 设计排版」 |
21
35
 
22
36
  ---
23
37
 
24
- # Markdown 编辑器
38
+ ## 给码字工作者的能力
39
+
40
+ ### ✍️ 写,像在用编辑器
25
41
 
26
- 一个专注于 Markdown 编辑体验的 Finch 小程序,同时提供微信公众号样式预览、框选文字请求 AI 修改,以及 AI 自定义排版。
42
+ - 原生 CodeMirror 6 内核:语法高亮、软换行、选区、撤销历史、行号,应有尽有。
43
+ - **草稿永不丢**:每次按键内容都会后台留存;就算手滑关掉标签页,重新打开也会自动恢复未保存的内容。文件在别处被改过?会提示冲突,但你的草稿仍然保留。
44
+ - **专注模式**:开启后光标所在行自动平滑滚动到屏幕中央,其余行 70% 变淡——长文写作不再追着光标跑。
45
+ - **紧凑 / 舒适**:两档行距,阅读时紧凑、写作时宽松,随时切换。
46
+ - 文件被外部修改会自动刷新,编辑器和磁盘永远同步。
27
47
 
28
- ## 使用方式
48
+ ### 🔍 批注:框选即问
29
49
 
30
- 1. Finch 右侧 Panel 打开 **Markdown 编辑器**,点击工具栏「文件夹」图标选择 `.md` 文件。
31
- 2. 直接编辑 Markdown;使用工具栏**保存**按钮或 `Cmd/Ctrl+S` 写入磁盘。文件被外部修改时,编辑器会自动刷新。
32
- 3. 点击「切换」按钮进入公众号预览,可在「调色板」菜单选择 bm.md 内置的 8 种排版风格。
33
- 4. 在编辑器或预览中框选文字,在浮层里描述修改要求,即可把精确上下文加入 Finch Composer。
34
- 5. 点击「魔杖」图标,让 Finch AI 基于 bm.md 的输出结构设计自定义 CSS。
35
- 6. 使用**复制 HTML**复制带内联样式的富文本,再粘贴到微信公众号编辑器。
50
+ 选中一段文字,弹窗里写下你的要求("更口语一点"、"扩写成三句话"、"换个更有力的开头"),内容会带着精确的行号和原文进入 Finch 对话。AI 改完给出可替换片段,确认后才写入文件——不会乱改你的稿子。
36
51
 
37
- ## 架构关系
52
+ ### 🎨 预览与排版
53
+
54
+ - 点击「预览」即时看到公众号文章效果,支持 8 种内置风格(暖纸感、几何撞色、蓝图网格、清新绿、报刊衬线、复古、手绘、终端)。
55
+ - 预览浮层可**复制到公众号**(内联样式富文本,直接粘贴)、导出图片或 PDF。
56
+ - 想要独一无二的排版?让 AI 基于你的文章设计自定义 CSS,一键应用并保存,下次写文直接复用。
57
+
58
+ ### 🛡️ 本地优先
59
+
60
+ - 所有文件都在你自己的磁盘上,内容不出本机。
61
+ - 渲染引擎 `bmmd` 独立安装、按需调用,没有常驻服务,也没有云端依赖。
62
+
63
+ ---
38
64
 
39
- Markdown 编辑器不是 bm.md 内置编辑器,而是小程序内集成的 CodeMirror 6。Markdown 解析、语法高亮、自动换行、选区、当前行、撤销历史和键盘编辑由 CodeMirror 负责;文件读写、选区批注、保存状态、工具栏交互和预览容器由 Finch 小程序负责。
65
+ ## 架构说明(给开发者)
40
66
 
41
- bm.md 只负责渲染。小程序会把 `bmmd` CLI 一次性安装到自己的私有存储目录,然后将当前 Markdown 交给 `bmmd render --platform wechat`;返回的内联样式 HTML 再显示到沙箱 iframe 中。文章内容全程留在本机,也不需要常驻 bm.md Web 服务。
67
+ 编辑器是小程序内集成的 CodeMirror 6,负责解析、高亮、选区、撤销与键盘编辑;文件读写、草稿恢复、批注上下文、保存状态、工具栏与预览容器由 Finch 小程序负责。bm.md 仅作为渲染引擎:小程序按需调用 `bmmd render --platform wechat`,把返回的内联样式 HTML 显示在沙箱 iframe 中。
42
68
 
43
- 小程序本身采用 MIT 许可证;bm.md / `bmmd` 为 AGPL-3.0,因此运行时独立安装,不直接打包进小程序。
69
+ 小程序采用 MIT 许可证;bm.md / `bmmd` 为 AGPL-3.0,运行时独立安装,不打包进本包。
package/dist/index.js CHANGED
@@ -765,7 +765,7 @@ function activate(ctx) {
765
765
  }));
766
766
  ctx.subscriptions.push(ctx.tools.register({
767
767
  name: "markdown_editor_document",
768
- title: "\u5199\u4F5C",
768
+ title: "\u5199\u5B57",
769
769
  description: `Open, create, revise, or restyle a Markdown document in Markdown Editor.
770
770
  action:
771
771
  open \u2014 read an absolute local Markdown path and open it as an editable WeChat article preview
package/dist/panel.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <title>写作</title>
6
+ <title>写字</title>
7
7
  <style>
8
8
  :root{
9
9
  --bg:var(--finch-bg-root,#f7f7f8);
@@ -145,7 +145,7 @@ body{margin:0;background:var(--bg);color:var(--text);font:13px var(--finch-font-
145
145
  <div class="home">
146
146
  <header class="home-head">
147
147
  <div>
148
- <h1 data-i18n="home.title">写作</h1>
148
+ <h1 data-i18n="home.title">写字</h1>
149
149
  <p id="homeTagline"></p>
150
150
  </div>
151
151
  <div class="home-cta">
@@ -234,7 +234,7 @@ body{margin:0;background:var(--bg);color:var(--text);font:13px var(--finch-font-
234
234
  var STR = {
235
235
  zh: {
236
236
  'meta.title': '公众号文章预览',
237
- 'home.title': '写作',
237
+ 'home.title': '写字',
238
238
  'home.tagline.withAssistant': '你与{name}一起编排 Markdown 文件',
239
239
  'home.tagline.default': '打开一个 Markdown 文件开始编辑与预览,或新建一篇文章。',
240
240
  'home.openFile': '打开文件',
@@ -248,7 +248,7 @@ body{margin:0;background:var(--bg);color:var(--text);font:13px var(--finch-font-
248
248
  'home.cwdTitle': '在访达 / 文件资源管理器中打开:{path}',
249
249
  'home.today': '今天 {clock}',
250
250
  'home.yesterday': '昨天 {clock}',
251
- 'editor.ariaLabel': '写作编辑器',
251
+ 'editor.ariaLabel': '写字编辑器',
252
252
  'actions.copyToWx': '复制到公众号',
253
253
  'actions.copyImg': '复制图片',
254
254
  'actions.exportImg': '导出图片(下载)',
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "Writing",
3
+ "description": "Write Markdown in Finch and preview it as a WeChat Official Account article — with selection-based AI edits, focus mode, and AI-designed custom styles.",
4
+ "systemPrompt": "When the user wants to edit or preview a local Markdown file, call markdown_editor_document with action 'open' and its absolute path. When the user asks to create/draft a brand-new Markdown document, write the full Markdown yourself and call action 'create' with an absolute path that does not exist yet plus the markdown content — it writes the file and opens it in the editor in one step (the editor UI intentionally has no \"new file\" button). When the user asks to revise a passage selected in the editor or preview, propose precise replacement Markdown and, once approved, call action 'apply' with the full updated Markdown. When the user asks for a custom/AI-designed WeChat layout style, write plain CSS scoped under #bm-md (tag/id selectors only, no classes, use !important where needed to override the base style), drawing on bm.md's built-in style languages (kami, bauhaus, blueprint, botanical, newsprint, retro, sketch, terminal), then call action 'set_style' with the css and a short label — it applies immediately to the open preview.",
5
+ "appPanel": {
6
+ "title": "Writing",
7
+ "toolbar": {
8
+ "open": { "tooltip": "Open a Markdown file" },
9
+ "annotate": { "label": "Annotate", "tooltip": "Turn on annotate" },
10
+ "mode": { "label": "Preview", "tooltip": "Switch to preview" },
11
+ "style": { "tooltip": "Layout style" },
12
+ "save": { "label": "Save", "tooltip": "Save (⌘/Ctrl+S)" },
13
+ "more": { "tooltip": "More actions" }
14
+ }
15
+ }
16
+ }
package/i18n/zh-CN.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "name": "写作",
2
+ "name": "写字",
3
3
  "description": "在 Finch 中编辑 Markdown,并可预览为微信公众号文章样式;支持框选文字请求 AI 修改和自定义排版。",
4
4
  "systemPrompt": "当用户要编辑或预览本地 Markdown 文件时,调用 markdown_editor_document,action 使用 open,并提供绝对路径。当用户要新建/起草一篇全新的 Markdown 文档时,自己先写好完整 Markdown 正文,再调用 action=create 并提供一个尚不存在的绝对路径和 markdown 内容——会一次性写入文件并在 Markdown 编辑器中打开(编辑器界面本身故意不提供“新建”按钮)。当用户要修改编辑器或预览中框选的文字时,给出精确的替换 Markdown,确认后调用 action=apply 并提供完整更新后的 Markdown。当用户要求自定义/AI 设计公众号排版风格时,编写限定在 #bm-md 下的普通 CSS(标签/id 选择器,不用 class,必要时用 !important 覆盖基础风格),可参考 bm.md 内置风格(kami、bauhaus、blueprint、botanical、newsprint、retro、sketch、terminal),然后调用 action=set_style 并提供 css 与简短 label,会立即应用到当前打开的预览。",
5
5
  "appPanel": {
6
- "title": "写作",
6
+ "title": "写字",
7
7
  "toolbar": {
8
8
  "open": { "tooltip": "打开 Markdown 文件" },
9
9
  "annotate": { "label": "批注", "tooltip": "开启批注" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finch-markdown-editor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A Markdown editor and WeChat Official Account style preview, with selection-based AI edits and AI-generated custom styles.",
5
5
  "author": {
6
6
  "name": "PuterJam",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "finch": {
35
35
  "manifestVersion": 1,
36
- "minVersion": "1.6.0",
37
- "name": "写作",
36
+ "minVersion": "1.6.1",
37
+ "name": "Writing",
38
38
  "description": "Edit Markdown and preview it as a WeChat Official Account article. Select text for AI edits, or ask AI to design a custom style.",
39
39
  "systemPrompt": "When the user wants to edit or preview a local Markdown file, call markdown_editor_document with action 'open' and its absolute path. When the user asks to create/draft a brand-new Markdown document, write the full Markdown yourself and call action 'create' with an absolute path that does not exist yet plus the markdown content — this writes the file and opens it in Markdown Editor in one step (Markdown Editor's own UI intentionally has no 'new file' button). When the user asks to revise a passage selected in Markdown Editor, propose precise replacement Markdown and, once approved, call action 'apply' with the full updated Markdown. When the user asks for a custom/AI-designed WeChat layout style, write plain CSS scoped under #bm-md (tag/id selectors only, use !important where needed to override the base style) inspired by bm.md's built-in styles (kami, bauhaus, blueprint, botanical, newsprint, retro, sketch, terminal), then call action 'set_style' with that css and a short label — it applies immediately in the open preview.",
40
40
  "main": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "iconPacks": [
51
51
  {
52
52
  "id": "markdown-editor-icons",
53
- "label": "写作图标"
53
+ "label": "写字图标"
54
54
  }
55
55
  ],
56
56
  "appPanel": {