md-to-mowen 1.2.1 → 1.3.1
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/.claude-plugin/plugin.json +49 -0
- package/README.md +2 -2
- package/dist/cli/index.js +5 -1
- package/dist/pipeline/hast-to-mast.js +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "md-to-mowen",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "将 Markdown(GFM)转换为墨问笔记的 CLI 工具,支持一键发布、智能编辑、图片处理、表格渲染等功能",
|
|
5
|
+
"skills": [
|
|
6
|
+
{
|
|
7
|
+
"name": "mowen",
|
|
8
|
+
"description": "默问 (Mowen) 文章发布/编辑技能 - 完整发布流程(HTML+CSS 高清表格渲染、质量检查、自动配图)",
|
|
9
|
+
"trigger": {
|
|
10
|
+
"keywords": ["墨问", "mowen", "发布笔记", "发布文章", "markdown 发布", "mowen publish"],
|
|
11
|
+
"commands": ["publish", "to-markdown", "privacy", "config"]
|
|
12
|
+
},
|
|
13
|
+
"instructions": "使用 md-to-mowen CLI 工具将 Markdown 文件发布到墨问平台。\n\n## 快速开始\n\n1. 配置 API Key: `md-to-mowen config`\n2. 发布笔记: `md-to-mowen publish -i article.md`\n3. 添加标签: `md-to-mowen publish -i article.md --tags \"tech,ai\"`\n\n## 功能特性\n\n- **一键发布** — 单文件或整个目录批量发布\n- **智能编辑** — 自动追踪文件与笔记映射,再次发布自动进入编辑模式\n- **图片处理** — 本地图片/远程 URL 自动上传到墨问 OSS\n- **表格渲染** — Markdown 表格自动渲染为高清 PNG 图片\n- **隐私控制** — 独立命令设置笔记公开/私密状态\n\n## 命令\n\n- `publish` — 发布笔记\n- `privacy` — 设置隐私状态\n- `to-markdown` — NoteAtom 转 Markdown\n- `config` — 配置 API Key"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"commands": [
|
|
17
|
+
{
|
|
18
|
+
"name": "publish",
|
|
19
|
+
"description": "发布 Markdown 文件到墨问笔记",
|
|
20
|
+
"binary": "md-to-mowen",
|
|
21
|
+
"args": ["publish", "-i", "${input}"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "privacy",
|
|
25
|
+
"description": "设置笔记隐私状态",
|
|
26
|
+
"binary": "md-to-mowen",
|
|
27
|
+
"args": ["privacy", "--note-id", "${noteId}", "--visibility", "${visibility}"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "to-markdown",
|
|
31
|
+
"description": "将 NoteAtom JSON 转换为 Markdown",
|
|
32
|
+
"binary": "md-to-mowen",
|
|
33
|
+
"args": ["to-markdown", "-i", "${input}", "-o", "${output}"]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "config",
|
|
37
|
+
"description": "配置墨问 API Key",
|
|
38
|
+
"binary": "md-to-mowen",
|
|
39
|
+
"args": ["config"]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"author": "tecson",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"homepage": "https://github.com/tecson/md-to-mowen#readme",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/tecson/md-to-mowen.git"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/README.md
CHANGED
|
@@ -135,7 +135,7 @@ md-to-mowen/
|
|
|
135
135
|
│ ├── publish/ # 发布流水线编排
|
|
136
136
|
│ └── shared/ # 工具函数
|
|
137
137
|
├── tests/ # 单元测试
|
|
138
|
-
└── docs/ #
|
|
138
|
+
└── docs/ # 学习指南与架构文档
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
## 开发
|
|
@@ -160,7 +160,7 @@ npm link
|
|
|
160
160
|
## 相关链接
|
|
161
161
|
|
|
162
162
|
- [墨问开放 API 文档](https://mowen.apifox.cn/)
|
|
163
|
-
- [
|
|
163
|
+
- [学习指南与架构文档](docs/README.md)
|
|
164
164
|
|
|
165
165
|
## License
|
|
166
166
|
|
package/dist/cli/index.js
CHANGED
|
@@ -15,6 +15,10 @@ import { mastToMarkdown } from '../mast/to-markdown.js';
|
|
|
15
15
|
import { findMetadataPath, readMetadata, writeMetadata, lookupNote, upsertNote } from '../shared/metadata.js';
|
|
16
16
|
import { loadConfig } from '../shared/config.js';
|
|
17
17
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
// 从 package.json 读取版本号
|
|
19
|
+
const packageJsonPath = join(__dirname, '../../package.json');
|
|
20
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
21
|
+
const VERSION = packageJson.version;
|
|
18
22
|
/** 按优先级搜索 .env 文件 */
|
|
19
23
|
function searchEnvPaths() {
|
|
20
24
|
const projectRoot = resolve(__dirname, '../../');
|
|
@@ -87,7 +91,7 @@ function saveApiKey(apiKey) {
|
|
|
87
91
|
loadEnvConfig();
|
|
88
92
|
// ── CLI ───────────────────────────────────────────────────────────────────────
|
|
89
93
|
const program = new Command();
|
|
90
|
-
program.name('md-to-mowen').description('将 Markdown(GFM)转换为墨问笔记').version(
|
|
94
|
+
program.name('md-to-mowen').description('将 Markdown(GFM)转换为墨问笔记').version(VERSION);
|
|
91
95
|
// ── config ────────────────────────────────────────────────────────────────────
|
|
92
96
|
program
|
|
93
97
|
.command('config')
|
|
@@ -284,7 +284,7 @@ function convertList(listEl, doc, opts, ordered, depth) {
|
|
|
284
284
|
paragraphContent.push(...extractInlineContent(liChild));
|
|
285
285
|
}
|
|
286
286
|
else {
|
|
287
|
-
paragraphContent.push(...
|
|
287
|
+
paragraphContent.push(...extractInline([liChild]));
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
// 构建带前缀的段落
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md-to-mowen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "将 Markdown(GFM)转换为墨问笔记的 CLI 工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"!dist/out"
|
|
11
|
+
"!dist/out",
|
|
12
|
+
".claude-plugin"
|
|
12
13
|
],
|
|
13
14
|
"exports": {
|
|
14
15
|
".": "./dist/publish/index.js",
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
"test:watch": "vitest",
|
|
25
26
|
"build": "tsc -p tsconfig.json && sh scripts/postbuild.sh && chmod +x dist/cli/index.js",
|
|
26
27
|
"release": "semantic-release",
|
|
27
|
-
"prepare": "husky"
|
|
28
|
+
"prepare": "husky",
|
|
29
|
+
"postinstall": "npx playwright install chromium"
|
|
28
30
|
},
|
|
29
31
|
"keywords": [
|
|
30
32
|
"markdown",
|
|
@@ -42,7 +44,8 @@
|
|
|
42
44
|
"unist-util-visit": "^5.0.0",
|
|
43
45
|
"hast-util-to-string": "^3.0.0",
|
|
44
46
|
"commander": "^12.0.0",
|
|
45
|
-
"dotenv": "^16.0.0"
|
|
47
|
+
"dotenv": "^16.0.0",
|
|
48
|
+
"playwright": "^1.40.0"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@semantic-release/changelog": "^6.0.3",
|
|
@@ -58,7 +61,6 @@
|
|
|
58
61
|
"semantic-release": "^24.0.0",
|
|
59
62
|
"tsx": "^4.0.0",
|
|
60
63
|
"typescript": "^5.0.0",
|
|
61
|
-
"vitest": "^1.0.0"
|
|
62
|
-
"playwright": "^1.0.0"
|
|
64
|
+
"vitest": "^1.0.0"
|
|
63
65
|
}
|
|
64
66
|
}
|