chore: update deps

pull/3237/head
Anthony Fu 2 years ago
parent a759d523ec
commit 3f11794390

@ -13,7 +13,23 @@ export default defineConfig({
cleanUrls: true, cleanUrls: true,
markdown: { markdown: {
math: true math: true,
transformers: [
// We use `[!!code` in demo to prevent transformation, here we revert it back.
{
code(code) {
for (const line of code.children) {
if (line.type !== 'element') continue
for (const token of line.children) {
if (token.type === 'element' && token.children[0].type === 'text') {
token.children[0].value = token.children[0].value.replace('[!!code', '[!code')
}
}
}
}
}
]
}, },
sitemap: { sitemap: {

@ -377,7 +377,7 @@ export default { // Highlighted
} }
``` ```
Alternatively, it's possible to highlight directly in the line by using the `// [!code hl]` comment. Alternatively, it's possible to highlight directly in the line by using the `// [!code hightlight]` comment.
**Input** **Input**
@ -386,7 +386,7 @@ Alternatively, it's possible to highlight directly in the line by using the `//
export default { export default {
data () { data () {
return { return {
msg: 'Highlighted!' // [!code hl] msg: 'Highlighted!' // [!!code highlight]
} }
} }
} }
@ -399,7 +399,7 @@ export default {
export default { export default {
data() { data() {
return { return {
msg: 'Highlighted!' // [!code hl] msg: 'Highlighted!' // [!code highlight]
} }
} }
} }
@ -413,14 +413,12 @@ Additionally, you can define a number of lines to focus using `// [!code focus:<
**Input** **Input**
Note that only one space is required after `!code`, here are two to prevent processing.
```` ````
```js ```js
export default { export default {
data () { data () {
return { return {
msg: 'Focused!' // [!code focus] msg: 'Focused!' // [!!code focus]
} }
} }
} }
@ -445,15 +443,13 @@ Adding the `// [!code --]` or `// [!code ++]` comments on a line will create a d
**Input** **Input**
Note that only one space is required after `!code`, here are two to prevent processing.
```` ````
```js ```js
export default { export default {
data () { data () {
return { return {
msg: 'Removed' // [!code --] msg: 'Removed' // [!!code --]
msg: 'Added' // [!code ++] msg: 'Added' // [!!code ++]
} }
} }
} }
@ -479,15 +475,13 @@ Adding the `// [!code warning]` or `// [!code error]` comments on a line will co
**Input** **Input**
Note that only one space is required after `!code`, here are two to prevent processing.
```` ````
```js ```js
export default { export default {
data () { data () {
return { return {
msg: 'Error', // [!code error] msg: 'Error', // [!!code error]
msg: 'Warning' // [!code warning] msg: 'Warning' // [!!code warning]
} }
} }
} }

@ -4,6 +4,7 @@ import type { LanguageInput, ShikijiTransformer } from 'shikiji'
import { import {
bundledLanguages, bundledLanguages,
getHighlighter, getHighlighter,
addClassToHast,
isPlaintext as isPlainLang isPlaintext as isPlainLang
} from 'shikiji' } from 'shikiji'
import type { Logger } from 'vite' import type { Logger } from 'vite'
@ -76,7 +77,7 @@ export async function highlight(
transformerNotationErrorLevel(), transformerNotationErrorLevel(),
{ {
pre(node) { pre(node) {
node.properties.class = 'vp-code shiki' addClassToHast(node, 'vp-code')
} }
} }
] ]

Loading…
Cancel
Save