emojiTool/README.md
hackrobot f13ac764e7
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
chore: rename project to emojiTool and brand for git.nomadro.cn
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 22:09:26 +08:00

116 lines
4.0 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 |
| Emoji 装饰排版 | 标题边框、列表符号、任务勾选、引用、分隔线等用 Unicode/Emoji 呈现 |
| 一键复制 | 复制为纯文本(表格用字符边框,粘贴到微信/IM 仍可见结构) |
| 草稿自动保存 | 本地 `localStorage` 持久化正文与页脚开关 |
| 模板与片段 | 内置公众号短文/任务清单等模板,工具栏可插入标题、列表等片段 |
| 页脚开关 | 可关闭/编辑自动追加的署名 |
| 左侧目录 | 解析 `#` 标题大纲,点击跳转 |
| 编辑模式 | MD 源码 / 普通编辑可切换(参考 [MarkText](https://github.com/marktext/marktext) 源码体验) |
| 右键插入 | MD 模式下右键插入标题、任务、表格、代码块等 |
| 外链菜单 | 「公众号: 异度世界」「mdemoji.com」 |
### Markdown 装饰规则(摘要)
- **H1**:`╭──╮` 边框 + `📢` 标题
- **H2 / H3**:前缀 `📝`
- **无序列表**:`🔸`,嵌套用 `┊`
- **有序列表**:`1️⃣` … `🔟`
- **任务列表**:`✅` / `⬜`
- **行内代码**:`『…』`
- **引用**:`└─⚡`
- **分隔线**:`➖➖➖➖➖`
- **链接**:`🔗文案` + URL
- **图片**:固定宽度约 `300px`
- **表格**:表头标注 `📊 表格 📊`
## 技术栈
- **桌面**: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 # Ink & Leaf 视觉
│ ├── index.ejs
│ └── lib/
│ ├── emojiMarkdown.ts # Markdown → Emoji 纯文本
│ ├── themes.ts
│ ├── toc.ts # 标题目录
│ ├── editorActions.ts # 右键插入动作
│ ├── storage.ts
│ └── templates.ts
│ └── components/
│ └── EditorPane.tsx # 左侧目录 + 编辑器
└── __tests__/
```
业务逻辑:渲染规则在 `lib/emojiMarkdown.ts`,交互在 `App.tsx`。
## 开发
环境要求: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`** | 当前最新业务分支,含 emoji 编辑器主体功能 |
| `main` | 接近 ERB 初始脚手架,明显落后于 `greenbook` |
| `feature/emoji` | 历史旁支,已被 `greenbook` 覆盖 |
## 已知说明
- 包名 / `productName` 已统一为 **emojitool** / **emojiTool**。
- 暂无云同步、多窗口;草稿保存在本机 `localStorage`(键:`emojitool.draft`)。
- 提供 A–D 四套纯文本主题,复制优先 `innerText`,表格为全角字符网格。
## License
MIT