diff --git a/packages/vant-cli/package.json b/packages/vant-cli/package.json index e63898ca7..9b707d5e7 100644 --- a/packages/vant-cli/package.json +++ b/packages/vant-cli/package.json @@ -54,7 +54,7 @@ "@types/webpack": "^4.41.13", "@types/webpack-dev-server": "^3.11.0", "@vant/eslint-config": "^2.2.2", - "@vant/markdown-loader": "^2.4.0", + "@vant/markdown-loader": "^2.5.0", "@vant/markdown-vetur": "^2.0.2", "@vant/stylelint-config": "^1.3.0", "@vant/touch-emulator": "^1.2.0", diff --git a/packages/vant-cli/yarn.lock b/packages/vant-cli/yarn.lock index c1ed16154..77066219e 100644 --- a/packages/vant-cli/yarn.lock +++ b/packages/vant-cli/yarn.lock @@ -1991,13 +1991,13 @@ eslint-plugin-import "^2.20.2" eslint-plugin-vue "^6.2.2" -"@vant/markdown-loader@^2.4.0": - version "2.4.0" - resolved "https://registry.npmjs.org/@vant/markdown-loader/-/markdown-loader-2.4.0.tgz#abc5471645eef7a91331e79b27179b8c8584982b" - integrity sha512-3TRzCctl4eCcm3o1cXaQpcvWZrf1lB2al/gU7yYiy/PTgCqIPzHgDMJT6b3TJ1cE0tszNgUDc056LMVIhMcNqg== +"@vant/markdown-loader@^2.5.0": + version "2.5.0" + resolved "https://registry.nlark.com/@vant/markdown-loader/download/@vant/markdown-loader-2.5.0.tgz?cache=0&sync_timestamp=1620007458334&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vant%2Fmarkdown-loader%2Fdownload%2F%40vant%2Fmarkdown-loader-2.5.0.tgz#08cb57da975d2f47c009695ff515b48920e37bbd" + integrity sha1-CMtX2pddL0fACWlf9RW0iSDje70= dependencies: front-matter "^3.0.2" - highlight.js "^9.17.1" + highlight.js "^10.0.0" loader-utils "^1.2.3" markdown-it "^10.0.0" markdown-it-anchor "^5.2.5" @@ -5922,10 +5922,10 @@ he@^1.2.0: resolved "https://registry.npm.taobao.org/he/download/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha1-hK5l+n6vsWX922FWauFLrwVmTw8= -highlight.js@^9.17.1: - version "9.18.5" - resolved "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.5.tgz#d18a359867f378c138d6819edfc2a8acd5f29825" - integrity sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA== +highlight.js@^10.0.0: + version "10.7.2" + resolved "https://registry.nlark.com/highlight.js/download/highlight.js-10.7.2.tgz#89319b861edc66c48854ed1e6da21ea89f847360" + integrity sha1-iTGbhh7cZsSIVO0ebaIeqJ+Ec2A= hmac-drbg@^1.0.0: version "1.0.1" diff --git a/packages/vant-markdown-loader/package.json b/packages/vant-markdown-loader/package.json index 194f3c5e7..b141bb537 100644 --- a/packages/vant-markdown-loader/package.json +++ b/packages/vant-markdown-loader/package.json @@ -1,6 +1,6 @@ { "name": "@vant/markdown-loader", - "version": "2.4.0", + "version": "2.5.0", "description": "Simple and fast vue markdown loader", "main": "src/index.js", "publishConfig": { @@ -10,7 +10,7 @@ "repository": "https://github.com/youzan/vant/tree/dev/packages/vant-markdown-loader", "dependencies": { "front-matter": "^3.0.2", - "highlight.js": "^9.17.1", + "highlight.js": "^10.0.0", "loader-utils": "^1.2.3", "markdown-it": "^10.0.0", "markdown-it-anchor": "^5.2.5", diff --git a/packages/vant-markdown-loader/src/highlight.js b/packages/vant-markdown-loader/src/highlight.js index 9adb9eecf..c5fed8c16 100644 --- a/packages/vant-markdown-loader/src/highlight.js +++ b/packages/vant-markdown-loader/src/highlight.js @@ -2,7 +2,8 @@ const hljs = require('highlight.js'); module.exports = function highlight(str, lang) { if (lang && hljs.getLanguage(lang)) { - return hljs.highlight(lang, str, true).value; + // https://github.com/highlightjs/highlight.js/issues/2277 + return hljs.highlight(str, { language: lang, ignoreIllegals: true }).value; } return ''; diff --git a/packages/vant-markdown-loader/yarn.lock b/packages/vant-markdown-loader/yarn.lock index 770fecda6..6ea6574b5 100644 --- a/packages/vant-markdown-loader/yarn.lock +++ b/packages/vant-markdown-loader/yarn.lock @@ -52,11 +52,6 @@ color-name@1.1.3: resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -commander@~2.20.3: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -101,23 +96,10 @@ get-caller-file@^2.0.1: resolved "https://registry.npm.taobao.org/get-caller-file/download/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha1-T5RBKoLbMvNuOwuXQfipf+sDH34= -handlebars@^4.5.3: - version "4.5.3" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.3.tgz#5cf75bd8714f7605713511a56be7c349becb0482" - integrity sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA== - dependencies: - neo-async "^2.6.0" - optimist "^0.6.1" - source-map "^0.6.1" - optionalDependencies: - uglify-js "^3.1.4" - -highlight.js@^9.17.1: - version "9.17.1" - resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.17.1.tgz#14a4eded23fd314b05886758bb906e39dd627f9a" - integrity sha512-TA2/doAur5Ol8+iM3Ov7qy3jYcr/QiJ2eDTdRF4dfbjG7AaaB99J5G+zSl11ljbl6cIcahgPY6SKb3sC3EJ0fw== - dependencies: - handlebars "^4.5.3" +highlight.js@^10.0.0: + version "10.7.2" + resolved "https://registry.nlark.com/highlight.js/download/highlight.js-10.7.2.tgz#89319b861edc66c48854ed1e6da21ea89f847360" + integrity sha1-iTGbhh7cZsSIVO0ebaIeqJ+Ec2A= is-fullwidth-code-point@^2.0.0: version "2.0.0" @@ -189,24 +171,6 @@ minimist@^1.2.0: resolved "https://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= - -neo-async@^2.6.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" - integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== - -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - p-limit@^2.0.0: version "2.2.1" resolved "https://registry.npm.taobao.org/p-limit/download/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" @@ -246,11 +210,6 @@ set-blocking@^2.0.0: resolved "https://registry.npm.taobao.org/set-blocking/download/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npm.taobao.org/sprintf-js/download/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -284,24 +243,11 @@ uc.micro@^1.0.1, uc.micro@^1.0.5: resolved "https://registry.npm.taobao.org/uc.micro/download/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" integrity sha1-nEEagCpAmpH8bPdAgbq6NLJEmaw= -uglify-js@^3.1.4: - version "3.7.2" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.2.tgz#cb1a601e67536e9ed094a92dd1e333459643d3f9" - integrity sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA== - dependencies: - commander "~2.20.3" - source-map "~0.6.1" - which-module@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/which-module/download/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"