@lyhue1991/wxgzh 0.1.0 → 0.1.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/README.md +3 -4
- package/dist/core/converter.js +5 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -31,11 +31,10 @@ wxgzh article.md
|
|
|
31
31
|
要求:Node.js >= 18
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install
|
|
35
|
-
npm run build
|
|
34
|
+
npm install -g @lyhue1991/wxgzh
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
安装完成后可直接使用 `wxgzh` 命令。
|
|
39
38
|
|
|
40
39
|
## 二、基本配置
|
|
41
40
|
|
|
@@ -401,7 +400,7 @@ wxgzh publish --article .wxgzh/article.html --cover .wxgzh/cover.jpg
|
|
|
401
400
|
|
|
402
401
|
## 开发与构建
|
|
403
402
|
|
|
404
|
-
|
|
403
|
+
开发环境安装依赖:
|
|
405
404
|
|
|
406
405
|
```bash
|
|
407
406
|
npm install
|
package/dist/core/converter.js
CHANGED
|
@@ -41,9 +41,9 @@ exports.extractPublishableContent = extractPublishableContent;
|
|
|
41
41
|
exports.readHtmlMetadata = readHtmlMetadata;
|
|
42
42
|
const promises_1 = require("node:fs/promises");
|
|
43
43
|
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
+
const css_inline_1 = require("@css-inline/css-inline");
|
|
44
45
|
const cheerio = __importStar(require("cheerio"));
|
|
45
46
|
const highlight_js_1 = __importDefault(require("highlight.js"));
|
|
46
|
-
const juice_1 = __importDefault(require("juice"));
|
|
47
47
|
const markdown_it_1 = __importDefault(require("markdown-it"));
|
|
48
48
|
const markdown_it_mathjax3_1 = __importDefault(require("markdown-it-mathjax3"));
|
|
49
49
|
const themes_1 = require("./themes");
|
|
@@ -615,13 +615,11 @@ async function renderMarkdownToHtml(body, metadata) {
|
|
|
615
615
|
const customCss = await loadCustomCss();
|
|
616
616
|
const articleHtml = $('article').html() ?? '';
|
|
617
617
|
const baseHtml = createDocumentHtml(articleHtml, metadata);
|
|
618
|
-
const inlinedHtml =
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
preserveFontFaces: true,
|
|
618
|
+
const inlinedHtml = (0, css_inline_1.inline)(baseHtml, {
|
|
619
|
+
extraCss: `${themeCss}\n${HIGHLIGHT_INLINE_CSS}\n${WECHAT_BLOCKQUOTE_INLINE_CSS}\n${WECHAT_TABLE_INLINE_CSS}\n${WECHAT_MATH_INLINE_CSS}\n${customCss}`,
|
|
620
|
+
keepAtRules: true,
|
|
622
621
|
applyWidthAttributes: false,
|
|
623
|
-
applyHeightAttributes: false
|
|
624
|
-
applyAttributesTableElements: true
|
|
622
|
+
applyHeightAttributes: false
|
|
625
623
|
});
|
|
626
624
|
return cleanInlinedHtml(inlinedHtml);
|
|
627
625
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyhue1991/wxgzh",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Markdown to WeChat Official Account draft CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/cli/index.js",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"node": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@css-inline/css-inline": "^0.20.0",
|
|
29
30
|
"axios": "^1.8.4",
|
|
30
|
-
"cheerio": "
|
|
31
|
+
"cheerio": "1.0.0-rc.12",
|
|
31
32
|
"commander": "^14.0.1",
|
|
32
33
|
"dotenv": "^16.4.7",
|
|
33
34
|
"form-data": "^4.0.2",
|
|
34
35
|
"gray-matter": "^4.0.3",
|
|
35
36
|
"highlight.js": "^11.11.1",
|
|
36
|
-
"juice": "^11.1.1",
|
|
37
37
|
"markdown-it": "^14.1.0",
|
|
38
38
|
"markdown-it-mathjax3": "^5.2.0",
|
|
39
39
|
"mathjax": "^4.1.1",
|