chore: upgrade to shiki rc (#3550)

pull/3559/head
Anthony Fu 10 months ago committed by GitHub
parent c582a8d5fd
commit 1d16a85fdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -102,9 +102,9 @@
"focus-trap": "^7.5.4", "focus-trap": "^7.5.4",
"mark.js": "8.11.1", "mark.js": "8.11.1",
"minisearch": "^6.3.0", "minisearch": "^6.3.0",
"shiki": "^1.0.0-beta.3", "shiki": "^1.0.0-rc.0",
"@shikijs/core": "^1.0.0-beta.3", "@shikijs/core": "^1.0.0-rc.0",
"@shikijs/transformers": "^1.0.0-beta.3", "@shikijs/transformers": "^1.0.0-rc.0",
"vite": "^5.0.12", "vite": "^5.0.12",
"vue": "^3.4.15" "vue": "^3.4.15"
}, },

@ -18,11 +18,11 @@ importers:
specifier: ^3.5.2 specifier: ^3.5.2
version: 3.5.2 version: 3.5.2
'@shikijs/core': '@shikijs/core':
specifier: ^1.0.0-beta.3 specifier: ^1.0.0-rc.0
version: 1.0.0-beta.3 version: 1.0.0-rc.0
'@shikijs/transformers': '@shikijs/transformers':
specifier: ^1.0.0-beta.3 specifier: ^1.0.0-rc.0
version: 1.0.0-beta.3 version: 1.0.0-rc.0
'@types/markdown-it': '@types/markdown-it':
specifier: ^13.0.7 specifier: ^13.0.7
version: 13.0.7 version: 13.0.7
@ -48,8 +48,8 @@ importers:
specifier: ^6.3.0 specifier: ^6.3.0
version: 6.3.0 version: 6.3.0
shiki: shiki:
specifier: ^1.0.0-beta.3 specifier: ^1.0.0-rc.0
version: 1.0.0-beta.3 version: 1.0.0-rc.0
vite: vite:
specifier: ^5.0.12 specifier: ^5.0.12
version: 5.0.12(@types/node@20.11.16) version: 5.0.12(@types/node@20.11.16)
@ -1299,14 +1299,14 @@ packages:
requiresBuild: true requiresBuild: true
optional: true optional: true
/@shikijs/core@1.0.0-beta.3: /@shikijs/core@1.0.0-rc.0:
resolution: {integrity: sha512-SCwPom2Wn8XxNlEeqdzycU93SKgzYeVsedjqDsgZaz4XiiPpZUzlHt2NAEQTwTnPcHNZapZ6vbkwJ8P11ggL3Q==} resolution: {integrity: sha512-j/7te+hvEYlQTvk/wPoA+1rOklZTz8QuyqVvV81KcEN/g1WXKVnqp9WZ7jFuv0ZVLqBtDx/V8viRDROJniyMLA==}
dev: false dev: false
/@shikijs/transformers@1.0.0-beta.3: /@shikijs/transformers@1.0.0-rc.0:
resolution: {integrity: sha512-ASQQQqxW4dANxMGw4yGkTjtMSsUaRhImv/lzJEdfJ3/eP8TVlVYnohOFQVgpLjBBYGy9P0l0oKrlbjiGosTJ/Q==} resolution: {integrity: sha512-1W4QpLKDM+hnlO6vqGre7orZxW4CrnO4F1zftj1KE6MdaEvy1awZKYUXPswvDIARvuetbzTvgc/ZE2yYVT/6GA==}
dependencies: dependencies:
shiki: 1.0.0-beta.3 shiki: 1.0.0-rc.0
dev: false dev: false
/@sideway/address@4.1.5: /@sideway/address@4.1.5:
@ -4441,10 +4441,10 @@ packages:
resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==}
dev: true dev: true
/shiki@1.0.0-beta.3: /shiki@1.0.0-rc.0:
resolution: {integrity: sha512-z7cHTNSSvwGx2DfeLwjSNLo+HcVxifgNIzLm6Ye52eXcIwNHXT0wHbhy7FDOKSKveuEHBwt9opfj3Hoc8LE1Yg==} resolution: {integrity: sha512-aeEjERF5qeK+YChgEv94LOjcEcjZBLd0acPaHginz0N8FvyTn2iSLhO0AtoqfvlZ8cWGCJRKLWtDApnQVQB6/Q==}
dependencies: dependencies:
'@shikijs/core': 1.0.0-beta.3 '@shikijs/core': 1.0.0-rc.0
dev: false dev: false
/side-channel@1.0.4: /side-channel@1.0.4:

@ -1,13 +1,7 @@
import { customAlphabet } from 'nanoid' import { customAlphabet } from 'nanoid'
import c from 'picocolors' import c from 'picocolors'
import type { ShikiTransformer } from 'shiki' import type { ShikiTransformer } from 'shiki'
import { import { bundledLanguages, getHighlighter, isSpecialLang } from 'shiki'
addClassToHast,
bundledLanguages,
getHighlighter,
isPlaintext as isPlainLang,
isSpecialLang
} from 'shiki'
import { import {
transformerCompactLineOptions, transformerCompactLineOptions,
transformerNotationDiff, transformerNotationDiff,
@ -85,7 +79,7 @@ export async function highlight(
{ {
name: 'vitepress:add-class', name: 'vitepress:add-class',
pre(node) { pre(node) {
addClassToHast(node, 'vp-code') this.addClassToHast(node, 'vp-code')
} }
}, },
{ {
@ -113,7 +107,7 @@ export async function highlight(
if (lang) { if (lang) {
const langLoaded = highlighter.getLoadedLanguages().includes(lang as any) const langLoaded = highlighter.getLoadedLanguages().includes(lang as any)
if (!langLoaded && !isPlainLang(lang) && !isSpecialLang(lang)) { if (!langLoaded && !isSpecialLang(lang)) {
logger.warn( logger.warn(
c.yellow( c.yellow(
`\nThe language '${lang}' is not loaded, falling back to '${ `\nThe language '${lang}' is not loaded, falling back to '${

Loading…
Cancel
Save