Skip to content

Shiki v4.0.0

Shiki v4.0.0 不再支持 Node.js 18,并移除了已弃用的 API。

在 Shiki 中,新功能会逐步在小版本中发布,而大版本主要用于清理和移除已弃用的 API。

破坏性变更

不再支持 Node.js 18

Shiki v4 需要 Node.js ≥ 20。Node.js 18 于 2025 年 4 月达到生命周期结束,不再受支持。

如果您当前使用的是 Node.js 18,请先升级到 Node.js 20 LTS 或更高版本,然后再升级到 Shiki v4。

移除已弃用的 API

移除 CreatedBundledHighlighterOptions

接口 CreatedBundledHighlighterOptions(拼写错误,误用 “Created” 代替 “Create”)已被移除。请改用 CreateBundledHighlighterOptions

ts
import type { CreatedBundledHighlighterOptions } from 'shiki'
import type { CreateBundledHighlighterOptions } from 'shiki'

移除 createdBundledHighlighter

函数 createdBundledHighlighter(拼写错误,误用 “created” 代替 “create”)已被移除。请改用 createBundledHighlighter

ts
import { createdBundledHighlighter } from 'shiki'
import { createBundledHighlighter } from 'shiki'

TwoslashFloatingVue 中移除 theme 选项

传入 TwoslashFloatingVue(来自 @shikijs/vitepress-twoslash)的单一 theme 选项被移除。请改用 themes

ts
app.use(TwoslashFloatingVue, {
  theme: { /* ... */ }, 
  themes: { /* ... */ }, 
})

移除 CSS 类 twoslash-query-presisted

拼写错误的 CSS 类 twoslash-query-presisted(注意拼写错误,缺失了第二个 s)已被移除。请改用正确的 twoslash-query-persisted