@wenyan-md/cli 1.0.1 → 1.0.2
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 +43 -30
- package/dist/{commands → types/commands}/publish.d.ts +0 -1
- package/dist/{commands → types/commands}/render.d.ts +0 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/{utils.d.ts → types/utils.d.ts} +0 -1
- package/package.json +25 -11
- package/dist/commands/publish.d.ts.map +0 -1
- package/dist/commands/render.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -4,21 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
# 文颜 CLI
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
「文颜」是一款多平台排版美化工具,让你将 Markdown 一键发布至微信公众号、知乎、今日头条等主流写作平台。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**文颜**现已推出多个版本:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
* [macOS App Store 版](https://github.com/caol64/wenyan) - MAC 桌面应用
|
|
12
|
+
* [Windows + Linux 版](https://github.com/caol64/wenyan-pc) - 跨平台桌面应用
|
|
13
|
+
* [CLI 版本](https://github.com/caol64/wenyan-cli) - CI/CD 或脚本自动化发布公众号文章
|
|
14
|
+
* [MCP 版本](https://github.com/caol64/wenyan-mcp) - 让 AI 自动发布公众号文章
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
本项目是 **文颜的 CLI 版本**。
|
|
14
17
|
|
|
15
|
-
##
|
|
18
|
+
## 功能
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
* 使用内置主题对 Markdown 内容排版
|
|
21
|
+
* 支持图片自动上传
|
|
22
|
+
* 支持数学公式渲染
|
|
23
|
+
* 一键发布文章到微信公众号草稿箱
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
## 主题效果
|
|
26
|
+
|
|
27
|
+
👉 [内置主题预览](https://yuzhi.tech/docs/wenyan/theme)
|
|
28
|
+
|
|
29
|
+
文颜采用了多个开源的 Typora 主题,在此向各位作者表示感谢:
|
|
30
|
+
|
|
31
|
+
- [Orange Heart](https://github.com/evgo2017/typora-theme-orange-heart)
|
|
32
|
+
- [Rainbow](https://github.com/thezbm/typora-theme-rainbow)
|
|
33
|
+
- [Lapis](https://github.com/YiNNx/typora-theme-lapis)
|
|
34
|
+
- [Pie](https://github.com/kevinzhao2233/typora-theme-pie)
|
|
35
|
+
- [Maize](https://github.com/BEATREE/typora-maize-theme)
|
|
36
|
+
- [Purple](https://github.com/hliu202/typora-purple-theme)
|
|
37
|
+
- [物理猫-薄荷](https://github.com/sumruler/typora-theme-phycat)
|
|
22
38
|
|
|
23
39
|
## 安装
|
|
24
40
|
|
|
@@ -26,8 +42,6 @@
|
|
|
26
42
|
npm install -g @wenyan-md/cli
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
---
|
|
30
|
-
|
|
31
45
|
## 基本用法
|
|
32
46
|
|
|
33
47
|
主命令为:
|
|
@@ -36,8 +50,6 @@ npm install -g @wenyan-md/cli
|
|
|
36
50
|
wenyan <command> [options]
|
|
37
51
|
```
|
|
38
52
|
|
|
39
|
-
---
|
|
40
|
-
|
|
41
53
|
## 环境变量
|
|
42
54
|
|
|
43
55
|
某些功能(如发布到微信公众号)需要配置以下环境变量:
|
|
@@ -72,8 +84,6 @@ $env:WECHAT_APP_ID="xxx"; $env:WECHAT_APP_SECRET="yyy"; wenyan publish "your mar
|
|
|
72
84
|
|
|
73
85
|
控制面板 → 系统和安全 → 系统 → 高级系统设置 → 环境变量 → 添加 `WECHAT_APP_ID` 和 `WECHAT_APP_SECRET`。
|
|
74
86
|
|
|
75
|
-
---
|
|
76
|
-
|
|
77
87
|
## 子命令
|
|
78
88
|
|
|
79
89
|
`publish`
|
|
@@ -87,10 +97,25 @@ $env:WECHAT_APP_ID="xxx"; $env:WECHAT_APP_SECRET="yyy"; wenyan publish "your mar
|
|
|
87
97
|
### 选项
|
|
88
98
|
|
|
89
99
|
- `-t`,主题id,默认`default`
|
|
100
|
+
- default
|
|
101
|
+
- orangeheart
|
|
102
|
+
- rainbow
|
|
103
|
+
- lapis
|
|
104
|
+
- pie
|
|
105
|
+
- maize
|
|
106
|
+
- purple
|
|
107
|
+
- phycat
|
|
90
108
|
- `-h`,代码高亮主题,默认`solarized-light`
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
- atom-one-dark
|
|
110
|
+
- atom-one-light
|
|
111
|
+
- dracula
|
|
112
|
+
- github-dark
|
|
113
|
+
- github
|
|
114
|
+
- monokai
|
|
115
|
+
- solarized-dark
|
|
116
|
+
- solarized-light
|
|
117
|
+
- xcode
|
|
118
|
+
- 代码块默认使用 Mac 风格,如要关闭:`--no-mac-style`
|
|
94
119
|
|
|
95
120
|
## 示例
|
|
96
121
|
|
|
@@ -106,15 +131,11 @@ wenyan publish "# Hello, Wenyan" -t lapis -h solarized-light
|
|
|
106
131
|
cat example.md | wenyan publish -t lapis -h solarized-light --no-mac-style
|
|
107
132
|
```
|
|
108
133
|
|
|
109
|
-
---
|
|
110
|
-
|
|
111
134
|
## 微信公众号 IP 白名单
|
|
112
135
|
|
|
113
136
|
请务必将服务器 IP 加入公众号平台的 IP 白名单,以确保上传接口调用成功。
|
|
114
137
|
详细配置说明请参考:[https://yuzhi.tech/docs/wenyan/upload](https://yuzhi.tech/docs/wenyan/upload)
|
|
115
138
|
|
|
116
|
-
---
|
|
117
|
-
|
|
118
139
|
## 配置说明(Frontmatter)
|
|
119
140
|
|
|
120
141
|
为了可以正确上传文章,需要在每一篇 Markdown 文章的开头添加一段`frontmatter`,提供`title`、`cover`两个字段:
|
|
@@ -132,8 +153,6 @@ cover: /Users/lei/Downloads/result_image.jpg
|
|
|
132
153
|
* 如果正文有至少一张图片,可省略,此时将使用其中一张作为封面;
|
|
133
154
|
* 如果正文无图片,则必须提供 cover。
|
|
134
155
|
|
|
135
|
-
---
|
|
136
|
-
|
|
137
156
|
## 关于图片自动上传
|
|
138
157
|
|
|
139
158
|
* 支持图片路径:
|
|
@@ -141,8 +160,6 @@ cover: /Users/lei/Downloads/result_image.jpg
|
|
|
141
160
|
* 本地路径(如:`/Users/lei/Downloads/result_image.jpg`)
|
|
142
161
|
* 网络路径(如:`https://example.com/image.jpg`)
|
|
143
162
|
|
|
144
|
-
---
|
|
145
|
-
|
|
146
163
|
## 示例文章格式
|
|
147
164
|
|
|
148
165
|
```md
|
|
@@ -160,14 +177,10 @@ cover: /Users/lei/Downloads/result_image.jpg
|
|
|
160
177
|

|
|
161
178
|
```
|
|
162
179
|
|
|
163
|
-
---
|
|
164
|
-
|
|
165
180
|
## 赞助
|
|
166
181
|
|
|
167
182
|
如果您觉得不错,可以给我家猫咪买点罐头吃。[喂猫❤️](https://yuzhi.tech/sponsor)
|
|
168
183
|
|
|
169
|
-
---
|
|
170
|
-
|
|
171
184
|
## License
|
|
172
185
|
|
|
173
186
|
Apache License Version 2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wenyan-md/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A CLI tool for Wenyan markdown rendering & publishing",
|
|
5
5
|
"author": "Lei <caol64@gmail.com> (https://github.com/caol64)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"keywords": [
|
|
7
|
+
"keywords": [
|
|
8
|
+
"公众号",
|
|
9
|
+
"markdown",
|
|
10
|
+
"文颜",
|
|
11
|
+
"wenyan",
|
|
12
|
+
"wechat",
|
|
13
|
+
"publishing",
|
|
14
|
+
"renderer"
|
|
15
|
+
],
|
|
8
16
|
"type": "module",
|
|
9
17
|
"bin": {
|
|
10
18
|
"wenyan": "./bin/cli.js"
|
|
11
19
|
},
|
|
12
20
|
"main": "./dist/index.js",
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
21
|
+
"types": "./dist/types/index.d.ts",
|
|
14
22
|
"files": [
|
|
15
23
|
"dist",
|
|
16
24
|
"bin"
|
|
17
25
|
],
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
"homepage": "https://github.com/caol64/wenyan-cli#readme",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/caol64/wenyan-cli.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/caol64/wenyan-cli/issues"
|
|
24
33
|
},
|
|
25
|
-
"packageManager": "pnpm@10.7.1",
|
|
26
34
|
"dependencies": {
|
|
27
35
|
"@wenyan-md/core": "^1.0.2",
|
|
28
36
|
"commander": "^14.0.0"
|
|
@@ -32,5 +40,11 @@
|
|
|
32
40
|
"dotenv-cli": "^10.0.0",
|
|
33
41
|
"tsx": "^4.20.5",
|
|
34
42
|
"typescript": "^5.9.2"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc",
|
|
46
|
+
"dev": "tsx src/index.ts",
|
|
47
|
+
"test:render": "cat test/publish.md | pnpm wenyan render",
|
|
48
|
+
"test:publish": "cat test/publish.md | pnpm dotenv -e .env.test -- wenyan publish -t lapis"
|
|
35
49
|
}
|
|
36
|
-
}
|
|
50
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,iBAiChF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/commands/render.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,iBAqB3F"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAQjD"}
|