Update version to v0.1.3-rc.5.2.2

This commit is contained in:
wisdgod
2025-03-15 13:47:28 +08:00
parent 6e00911d7c
commit 6c184cdba3
51 changed files with 3338 additions and 1297 deletions

View File

@@ -6,6 +6,7 @@ const CleanCSS = require('clean-css');
const MarkdownIt = require('markdown-it');
const fs = require('fs');
const path = require('path');
const MarkdownItAnchor = require('markdown-it-anchor');
// 配置选项
const options = {
@@ -41,6 +42,9 @@ async function minifyFile(inputPath, outputPath) {
html: true,
linkify: true,
typographer: true
}).use(MarkdownItAnchor, {
// 可选自定义slug生成函数
slugify: (s) => String(s).trim().toLowerCase().replace(/\s+/g, '-').replace(/[^\w\u4e00-\u9fa5\-]/g, '')
});
const readmeMdPath = path.join(__dirname, '..', 'README.md');
const markdownContent = fs.readFileSync(readmeMdPath, 'utf8');
@@ -108,6 +112,21 @@ async function minifyFile(inputPath, outputPath) {
a {
color: #58a6ff;
}
/* 标题链接样式 */
h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
opacity: 1;
}
.header-anchor {
opacity: 0;
font-size: 0.85em;
margin-left: 0.25em;
text-decoration: none;
}
</style>
</head>
<body>
@@ -123,6 +142,10 @@ async function minifyFile(inputPath, outputPath) {
minified = await minifyHtml(content, options);
minified = minified.replace(/`([\s\S]*?)`/g, (_match, p1) => {
return '`' + p1.replace(/\\n\s+/g, '') + '`';
}).replace(/'([\s\S]*?)'/g, (_match, p1) => {
return '\'' + p1.replace(/\\n\s+/g, '') + '\'';
}).replace(/"([\s\S]*?)"/g, (_match, p1) => {
return '"' + p1.replace(/\\n\s+/g, '') + '"';
});
break;
case '.js':
@@ -130,6 +153,10 @@ async function minifyFile(inputPath, outputPath) {
minified = result.code;
minified = minified.replace(/`([\s\S]*?)`/g, (_match, p1) => {
return '`' + p1.replace(/\\n\s+/g, '') + '`';
}).replace(/'([\s\S]*?)'/g, (_match, p1) => {
return '\'' + p1.replace(/\\n\s+/g, '') + '\'';
}).replace(/"([\s\S]*?)"/g, (_match, p1) => {
return '"' + p1.replace(/\\n\s+/g, '') + '"';
});
break;
case '.css':

View File

@@ -11,6 +11,7 @@
"clean-css": "^5.3.3",
"html-minifier-terser": "^7.2.0",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.2.0",
"terser": "^5.37.0"
},
"engines": {
@@ -75,6 +76,31 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@types/linkify-it": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==",
"license": "MIT",
"peer": true
},
"node_modules/@types/markdown-it": {
"version": "14.1.2",
"resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz",
"integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/linkify-it": "^5",
"@types/mdurl": "^2"
}
},
"node_modules/@types/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==",
"license": "MIT",
"peer": true
},
"node_modules/acorn": {
"version": "8.14.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
@@ -208,6 +234,16 @@
"markdown-it": "bin/markdown-it.mjs"
}
},
"node_modules/markdown-it-anchor": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-9.2.0.tgz",
"integrity": "sha512-sa2ErMQ6kKOA4l31gLGYliFQrMKkqSO0ZJgGhDHKijPf0pNFM9vghjAh3gn26pS4JDRs7Iwa9S36gxm3vgZTzg==",
"license": "Unlicense",
"peerDependencies": {
"@types/markdown-it": "*",
"markdown-it": "*"
}
},
"node_modules/mdurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",

View File

@@ -9,6 +9,7 @@
"clean-css": "^5.3.3",
"html-minifier-terser": "^7.2.0",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.2.0",
"terser": "^5.37.0"
}
}