Skip to content

Commit

Permalink
feat: modify config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jayconscious committed Jan 21, 2025
1 parent bac4a58 commit bf2eadf
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
16 changes: 14 additions & 2 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const moment = require('moment');
const markdownIt = require('markdown-it');
const markdownItAttrs = require('markdown-it-attrs');
const { react, vue2, dontknowjs1, dontknowjs2, tstutorial, webpack } = require('./sidebarCfg')

const isProduction = process.env.NODE_ENV === 'production'
Expand Down Expand Up @@ -62,19 +64,29 @@ module.exports = {
},
markdown: {
lineNumbers: true,
linkify: true,
// linkify: true,
// assets: {
// // 设置为 true,表示在资源路径前加上 base 路径,2.0 以上生效
// absolutePathPrependBase: true
// }
extendMarkdown: md => {
md.use(markdownItAttrs); // 启用 markdown-it-attrs 插件
md.renderer.rules.image = (tokens, idx) => {
const token = tokens[idx];
const src = token.attrs[0][1];
// 修改图片路径
const updatedSrc = `/blog${src}`; // 这里可以根据需要修改路径
return `<img src="${updatedSrc}" alt="${token.content}" />`;
};
},
},
plugins: [
['@vuepress/back-to-top', true]
],
configureWebpack: (config, isServer) => {
// config.module.rules.push({
// test: /\.(png|jpe?g|gif|svg|webp)$/,
// use: [
// use: [ya
// {
// loader: 'file-loader',
// options: {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"license": "ISC",
"dependencies": {
"@vuepress/plugin-back-to-top": "^1.7.1",
"markdown-it": "^14.1.0",
"markdown-it-attrs": "^4.3.1",
"moment": "^2.27.0",
"yard": "^1.0.3",
"yarn": "^1.22.22"
Expand Down
46 changes: 45 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,11 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"

argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.npmmirror.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

arr-diff@^4.0.0:
version "4.0.0"
resolved "https://registry.npmmirror.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
Expand Down Expand Up @@ -3881,7 +3886,7 @@ entities@^2.0.0:
resolved "https://registry.npmmirror.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55"
integrity sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==

entities@^4.5.0:
entities@^4.4.0, entities@^4.5.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48"
integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==
Expand Down Expand Up @@ -6051,6 +6056,13 @@ linkify-it@^2.0.0:
dependencies:
uc.micro "^1.0.1"

linkify-it@^5.0.0:
version "5.0.0"
resolved "https://registry.npmmirror.com/linkify-it/-/linkify-it-5.0.0.tgz#9ef238bfa6dc70bd8e7f9572b52d369af569b421"
integrity sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==
dependencies:
uc.micro "^2.0.0"

load-script@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/load-script/-/load-script-1.0.0.tgz#0491939e0bee5643ee494a7e3da3d2bac70c6ca4"
Expand Down Expand Up @@ -6278,6 +6290,11 @@ markdown-it-anchor@^5.0.2:
resolved "https://registry.npmmirror.com/markdown-it-anchor/-/markdown-it-anchor-5.3.0.tgz#d549acd64856a8ecd1bea58365ef385effbac744"
integrity sha512-/V1MnLL/rgJ3jkMWo84UR+K+jF1cxNG1a+KwqeXqTIJ+jtA8aWSHuigx8lTzauiIjBDbwF3NcWQMotd0Dm39jA==

markdown-it-attrs@^4.3.1:
version "4.3.1"
resolved "https://registry.npmmirror.com/markdown-it-attrs/-/markdown-it-attrs-4.3.1.tgz#1e1f9bd2c87276d8f4ed74ad4268df428b7deee6"
integrity sha512-/ko6cba+H6gdZ0DOw7BbNMZtfuJTRp9g/IrGIuz8lYc/EfnmWRpaR3CFPnNbVz0LDvF8Gf1hFGPqrQqq7De0rg==

markdown-it-chain@^1.3.0:
version "1.3.0"
resolved "https://registry.npmmirror.com/markdown-it-chain/-/markdown-it-chain-1.3.0.tgz#ccf6fe86c10266bafb4e547380dfd7f277cc17bc"
Expand All @@ -6300,6 +6317,18 @@ markdown-it-table-of-contents@^0.4.0:
resolved "https://registry.npmmirror.com/markdown-it-table-of-contents/-/markdown-it-table-of-contents-0.4.4.tgz#3dc7ce8b8fc17e5981c77cc398d1782319f37fbc"
integrity sha512-TAIHTHPwa9+ltKvKPWulm/beozQU41Ab+FIefRaQV1NRnpzwcV9QOe6wXQS5WLivm5Q/nlo0rl6laGkMDZE7Gw==

markdown-it@^14.1.0:
version "14.1.0"
resolved "https://registry.npmmirror.com/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
integrity sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==
dependencies:
argparse "^2.0.1"
entities "^4.4.0"
linkify-it "^5.0.0"
mdurl "^2.0.0"
punycode.js "^2.3.1"
uc.micro "^2.1.0"

markdown-it@^8.4.1:
version "8.4.2"
resolved "https://registry.npmmirror.com/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54"
Expand Down Expand Up @@ -6363,6 +6392,11 @@ mdurl@^1.0.1:
resolved "https://registry.npmmirror.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==

mdurl@^2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/mdurl/-/mdurl-2.0.0.tgz#80676ec0433025dd3e17ee983d0fe8de5a2237e0"
integrity sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==

[email protected]:
version "0.3.0"
resolved "https://registry.npmmirror.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
Expand Down Expand Up @@ -7661,6 +7695,11 @@ pumpify@^1.3.3:
inherits "^2.0.3"
pump "^2.0.0"

punycode.js@^2.3.1:
version "2.3.1"
resolved "https://registry.npmmirror.com/punycode.js/-/punycode.js-2.3.1.tgz#6b53e56ad75588234e79f4affa90972c7dd8cdb7"
integrity sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==

punycode@^1.2.4, punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.npmmirror.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
Expand Down Expand Up @@ -9169,6 +9208,11 @@ uc.micro@^1.0.1, uc.micro@^1.0.5:
resolved "https://registry.npmmirror.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==

uc.micro@^2.0.0, uc.micro@^2.1.0:
version "2.1.0"
resolved "https://registry.npmmirror.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==

[email protected]:
version "3.4.10"
resolved "https://registry.npmmirror.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f"
Expand Down

0 comments on commit bf2eadf

Please sign in to comment.