emojiTool/README.md
hackrobot de3ea81b91
Some checks are pending
Test / test (macos-latest) (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
Test / test (windows-latest) (push) Waiting to run
feat: polish editor UX, menus, and markdown rendering
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-02 07:27:17 +08:00

112 lines
3.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# emojiTool
面向微信公众号、聊天框等**纯文本输入场景**的桌面 Markdown 工具:把 Markdown 转成带 Emoji / Unicode 装饰的纯文本,复制后可直接粘贴,不依赖 HTML/CSS 样式。
- 产品名:**emojiTool**
- 窗口标题:emojiTool
- 仓库:[git.nomadro.cn/hackrobot/emojiTool](https://git.nomadro.cn/hackrobot/emojiTool)
- 在线品牌:[mdemoji.com](https://mdemoji.com) / [nomadro.com](https://nomadro.com)
- 公众号:[异度世界](https://www.hackrobot.cn)
- 主开发分支:`greenbook`
基于 [Electron React Boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate) 改造。
## 功能
| 能力 | 说明 |
|------|------|
| Markdown 实时预览 | 左侧编辑、右侧预览,基于 `marked` 自定义 Renderer |
| 四套主题 A–D | 经典 / 青简 / 精简 / 聚焦,下拉切换 |
| Emoji 装饰排版 | 标题边框、列表符号、任务勾选、引用、分隔线等用 Unicode/Emoji 呈现 |
| 一键复制 | 复制为纯文本(表格用全角字符网格,粘贴到微信/IM 仍可见结构) |
| 草稿自动保存 | 本地 `localStorage`(键:`emojitool.draft`) |
| 模板与片段 | 内置语法全览等模板;工具栏片段插入到**光标处** |
| 页脚开关 | 可关闭/编辑自动追加的署名 |
| 左侧目录 | 解析 `#` 标题大纲,点击跳转 |
| 编辑模式 | MD 源码 / 普通编辑可切换 |
| 右键与快捷键 | MD 模式:右键插入;`Ctrl+B` 加粗、`Ctrl+I` 斜体、`Ctrl+K` 链接;`Ctrl+Enter` 复制;`Ctrl+S` 保存 |
| 外链菜单 | 异度世界 / mdemoji.com / 仓库 |
### Markdown 装饰规则(摘要 · 主题 A)
- **H1**:`╭──╮` 边框 + `📢` 标题
- **H2**:前缀 `📝`;**H3**:`📎`;**H4**:`▪️`
- **无序列表**:`🔸`,嵌套用 `┊`
- **有序列表**:`1️⃣` … `🔟`
- **任务列表**:`✅` / `⬜`
- **行内代码**:`『…』`
- **引用**:`└─⚡`(多行各自成行)
- **分隔线**:`➖➖➖➖➖`
- **链接**:`🔗文案` + URL
- **图片**:纯文本 `🖼 说明:url`
- **表格**:全角字符网格(Theme B 为 pipe 风格)
## 技术栈
- **桌面**:Electron 26 + electron-builder
- **前端**:React 18、TypeScript、Ant Design 5、Sass Modules
- **Markdown**:marked
- **构建**:Webpack 5(ERB 配置)、electronmon 热重载
## 目录结构
```
src/
├── main/ # Electron 主进程(窗口、菜单、自动更新)
│ ├── main.ts
│ ├── menu.ts
│ ├── preload.ts
│ └── util.ts
├── renderer/ # 渲染进程
│ ├── App.tsx # 布局与交互
│ ├── App.module.scss
│ ├── index.ejs
│ ├── components/
│ │ └── EditorPane.tsx
│ └── lib/
│ ├── emojiMarkdown.ts
│ ├── themes.ts
│ ├── plainTable.ts
│ ├── toc.ts
│ ├── editorActions.ts
│ ├── storage.ts
│ └── templates.ts
└── __tests__/
```
## 开发
环境要求:Node.js ≥ 14,npm ≥ 7。
```bash
git checkout greenbook
npm install
npm start
```
| 命令 | 说明 |
|------|------|
| `npm start` | 启动开发环境 |
| `npm run build` | 构建 main + renderer |
| `npm run package` | 打包安装包到 `release/build` |
| `npm test` | 运行 Jest |
| `npm run lint` | ESLint |
## 分支说明
| 分支 | 说明 |
|------|------|
| **`greenbook`** | 当前最新业务分支 |
| `main` | 接近 ERB 初始脚手架,明显落后于 `greenbook` |
| `feature/emoji` | 历史旁支,已被 `greenbook` 覆盖 |
## 已知说明
- 包名 / `productName` 已统一为 **emojitool** / **emojiTool**。
- 暂无云同步、多窗口;草稿保存在本机。
- 复制优先 `innerText`,表格为全角字符网格(box / pipe / dots)。
## License
MIT