Skip to content

Commit b8487d3

Browse files
authored
feat: rename shiki packages (#3506)
BREAKING CHANGE: vitepress now uses shiki instead of shikiji. If you’re on the latest version and using shikiji specific features, you just need to change imports. The shikijiSetup hook is renamed to shikiSetup.
1 parent e060617 commit b8487d3

File tree

9 files changed

+47
-47
lines changed

9 files changed

+47
-47
lines changed

Diff for: docs/guide/markdown.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ VitePress also supports [GitHub-flavored alerts](https://docs.github.com/en/get-
301301
302302
## Syntax Highlighting in Code Blocks
303303

304-
VitePress uses [Shikiji](https://github.com/antfu/shikiji) (an improved version of [Shiki](https://shiki.matsu.io/)) to highlight language syntax in Markdown code blocks, using coloured text. Shiki supports a wide variety of programming languages. All you need to do is append a valid language alias to the beginning backticks for the code block:
304+
VitePress uses [Shiki](https://github.com/shikijs/shiki) to highlight language syntax in Markdown code blocks, using coloured text. Shiki supports a wide variety of programming languages. All you need to do is append a valid language alias to the beginning backticks for the code block:
305305

306306
**Input**
307307

@@ -341,7 +341,7 @@ export default {
341341
</ul>
342342
```
343343

344-
A [list of valid languages](https://github.com/antfu/shikiji/blob/main/docs/languages.md) is available on Shikiji's repository.
344+
A [list of valid languages](https://shiki.style/languages) is available on Shiki's repository.
345345

346346
You may also customize syntax highlight theme in app config. Please see [`markdown` options](../reference/site-config#markdown) for more details.
347347

Diff for: docs/reference/site-config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ When using the default theme, enabling this option will display each page's last
510510

511511
- Type: `MarkdownOption`
512512

513-
Configure Markdown parser options. VitePress uses [Markdown-it](https://github.com/markdown-it/markdown-it) as the parser, and [Shikiji](https://github.com/antfu/shikiji) (an improved version of [Shiki](https://shiki.matsu.io/)) to highlight language syntax. Inside this option, you may pass various Markdown related options to fit your needs.
513+
Configure Markdown parser options. VitePress uses [Markdown-it](https://github.com/markdown-it/markdown-it) as the parser, and [Shiki](https://github.com/shikijs/shiki) to highlight language syntax. Inside this option, you may pass various Markdown related options to fit your needs.
514514

515515
```js
516516
export default {

Diff for: docs/zh/guide/markdown.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ VitePress 同样支持以标注的方式渲染 [GitHub 风格的警报](https://
301301
302302
## 代码块中的语法高亮 {#syntax-highlighting-in-code-blocks}
303303

304-
VitePress 使用 [Shikiji](https://github.com/antfu/shikiji) ([Shiki](https://shiki.matsu.io/) 的改进版本) 在 Markdown 代码块中使用彩色文本实现语法高亮。Shiki 支持多种编程语言。需要做的就是将有效的语言别名附加到代码块的开头:
304+
VitePress 使用 [Shiki](https://github.com/shikijs/shiki) 在 Markdown 代码块中使用彩色文本实现语法高亮。Shiki 支持多种编程语言。需要做的就是将有效的语言别名附加到代码块的开头:
305305

306306
**输入**
307307

@@ -341,7 +341,7 @@ export default {
341341
</ul>
342342
```
343343

344-
Shikiji 的代码仓库中,可以找到[合法的编程语言列表](https://github.com/antfu/shikiji/blob/main/docs/languages.md)
344+
Shiki 的代码仓库中,可以找到[合法的编程语言列表](https://shiki.style/languages)
345345

346346
还可以全局配置中自定义语法高亮主题。有关详细信息,参见 [`markdown` 选项](../reference/site-config#markdown)得到更多信息。
347347

Diff for: docs/zh/reference/site-config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export default {
510510

511511
- 类型:`MarkdownOption`
512512

513-
配置 Markdown 解析器选项。VitePress 使用 [Markdown-it](https://github.com/markdown-it/markdown-it) 作为解析器,使用 [Shikiji](https://github.com/antfu/shikiji) ([Shiki](https://shiki.matsu.io/) 的改进版本) 来高亮不同语言语法。在此选项中,可以传递各种 Markdown 相关选项以满足你的需要。
513+
配置 Markdown 解析器选项。VitePress 使用 [Markdown-it](https://github.com/markdown-it/markdown-it) 作为解析器,使用 [Shiki](https://github.com/shikijs/shiki) 来高亮不同语言语法。在此选项中,可以传递各种 Markdown 相关选项以满足你的需要。
514514

515515
```js
516516
export default {

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@
102102
"focus-trap": "^7.5.4",
103103
"mark.js": "8.11.1",
104104
"minisearch": "^6.3.0",
105-
"shikiji": "^0.10.0",
106-
"shikiji-core": "^0.10.0",
107-
"shikiji-transformers": "^0.10.0",
105+
"shiki": "^1.0.0-beta.0",
106+
"@shikijs/core": "^1.0.0-beta.0",
107+
"@shikijs/transformers": "^1.0.0-beta.0",
108108
"vite": "^5.0.12",
109109
"vue": "^3.4.15"
110110
},

Diff for: pnpm-lock.yaml

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/node/markdown/markdown.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import type {
2323
BuiltinTheme,
2424
Highlighter,
2525
LanguageInput,
26-
ShikijiTransformer,
26+
ShikiTransformer,
2727
ThemeRegistrationAny
28-
} from 'shikiji'
28+
} from 'shiki'
2929
import type { Logger } from 'vite'
3030
import { containerPlugin, type ContainerOptions } from './plugins/containers'
3131
import { highlight } from './plugins/highlight'
@@ -75,21 +75,21 @@ export interface MarkdownOptions extends MarkdownIt.Options {
7575
* @example { theme: { light: 'github-light', dark: 'github-dark' } }
7676
*
7777
* You can use an existing theme.
78-
* @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#all-themes
78+
* @see https://shiki.style/themes
7979
* Or add your own theme.
80-
* @see https://github.com/antfu/shikiji/blob/main/docs/themes.md#load-custom-themes
80+
* @see https://shiki.style/guide/load-theme
8181
*/
8282
theme?: ThemeOptions
8383
/**
8484
* Languages for syntax highlighting.
85-
* @see https://github.com/antfu/shikiji/blob/main/docs/languages.md#all-themes
85+
* @see https://shiki.style/languages
8686
*/
8787
languages?: LanguageInput[]
8888
/**
8989
* Custom language aliases.
9090
*
9191
* @example { 'my-lang': 'js' }
92-
* @see https://github.com/antfu/shikiji/tree/main#custom-language-aliases
92+
* @see https://shiki.style/guide/load-lang#custom-language-aliases
9393
*/
9494
languageAlias?: Record<string, string>
9595
/**
@@ -103,13 +103,13 @@ export interface MarkdownOptions extends MarkdownIt.Options {
103103
defaultHighlightLang?: string
104104
/**
105105
* Transformers applied to code blocks
106-
* @see https://github.com/antfu/shikiji#hast-transformers
106+
* @see https://shiki.style/guide/transformers
107107
*/
108-
codeTransformers?: ShikijiTransformer[]
108+
codeTransformers?: ShikiTransformer[]
109109
/**
110-
* Setup Shikiji instance
110+
* Setup Shiki instance
111111
*/
112-
shikijiSetup?: (shikiji: Highlighter) => void | Promise<void>
112+
shikiSetup?: (shiki: Highlighter) => void | Promise<void>
113113

114114
/* ==================== Markdown It Plugins ==================== */
115115

Diff for: src/node/markdown/plugins/highlight.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { customAlphabet } from 'nanoid'
22
import c from 'picocolors'
3-
import type { ShikijiTransformer } from 'shikiji'
3+
import type { ShikiTransformer } from 'shiki'
44
import {
55
addClassToHast,
66
bundledLanguages,
77
getHighlighter,
88
isPlaintext as isPlainLang,
99
isSpecialLang
10-
} from 'shikiji'
10+
} from 'shiki'
1111
import {
1212
transformerCompactLineOptions,
1313
transformerNotationDiff,
1414
transformerNotationErrorLevel,
1515
transformerNotationFocus,
1616
transformerNotationHighlight,
1717
type TransformerCompactLineOption
18-
} from 'shikiji-transformers'
18+
} from '@shikijs/transformers'
1919
import type { Logger } from 'vite'
2020
import type { MarkdownOptions, ThemeOptions } from '../markdown'
2121

@@ -72,9 +72,9 @@ export async function highlight(
7272
langAlias: options.languageAlias
7373
})
7474

75-
await options?.shikijiSetup?.(highlighter)
75+
await options?.shikiSetup?.(highlighter)
7676

77-
const transformers: ShikijiTransformer[] = [
77+
const transformers: ShikiTransformer[] = [
7878
transformerNotationDiff(),
7979
transformerNotationFocus({
8080
classActiveLine: 'has-focus',

Diff for: template/markdown-examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page demonstrates some of the built-in markdown extensions provided by Vite
44

55
## Syntax Highlighting
66

7-
VitePress provides Syntax Highlighting powered by [Shikiji](https://github.com/antfu/shikiji), with additional features like line-highlighting:
7+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
88

99
**Input**
1010

0 commit comments

Comments
 (0)