fix: build action

This commit is contained in:
hmol233 2021-09-11 18:37:02 +08:00
parent db3c7540e5
commit e95da031d1
No known key found for this signature in database
GPG Key ID: D617A9DAB0C992D5
6 changed files with 21 additions and 13 deletions

View File

@ -11,6 +11,9 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

View File

@ -131,16 +131,4 @@ export default defineUserConfig<DefaultThemeOptions>({
md.use(require("markdown-it-footnote"));
},
bundler: isProduction ? "@vuepress/webpack" : "@vuepress/vite",
bundlerConfig: {
chainWebpack: (config) => {
config.module
.rule("webp")
.test(/\.(webp)(\?.*)?$/)
.use("file-loader")
.loader("file-loader")
.options({
name: `assets/img/[name].[hash:8].[ext]`,
});
},
},
});

View File

@ -8,13 +8,14 @@ const MermaidPlugin: PluginSimple = function (md) {
md.renderer.rules.fence = (...args) => {
const [tokens, idx] = args;
const { info } = tokens[idx];
if (info.trim(" ") === "mermaid") {
if (info.trim() === "mermaid") {
const token = tokens[idx];
const key = `mermaid_${hash(idx)}`;
let { content } = token;
content = content.replaceAll(";\n", ";");
content = content.replaceAll("\n\n", ";");
content = content.replaceAll("\n", ";");
content = content.replaceAll('"', "'");
return `<Mermaid identifier="${key}" graph="${content}"></Mermaid>`;
}
const rawCode = fence(...args);

View File

@ -9,6 +9,7 @@
"@types/bootstrap": "^5.1.4",
"@types/jquery": "^3.5.6",
"@types/mermaid": "^8.2.7",
"@types/node": "^16.9.1",
"@vuepress/bundler-vite": "^2.0.0-beta.25",
"@vuepress/plugin-back-to-top": "^2.0.0-beta.25",
"@vuepress/plugin-debug": "^2.0.0-beta.25",

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"sourceMap": true
},
"exclude": [
"node_modules"
]
}

View File

@ -237,6 +237,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.0.0.tgz#067a6c49dc7a5c2412a505628e26902ae967bf6f"
integrity sha512-TmCW5HoZ2o2/z2EYi109jLqIaPIi9y/lc2LmDCWzuCi35bcaQ+OtUh6nwBiFK7SOu25FAU5+YKdqFZUwtqGSdg==
"@types/node@^16.9.1":
version "16.9.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708"
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"