Skip to content

Commit a04b3e2

Browse files
committed
feat!: rename to shiki
1 parent 820834a commit a04b3e2

File tree

320 files changed

+999
-1679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+999
-1679
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ lib-cov
99
logs
1010
node_modules
1111
temp
12-
packages/shikiji/src/assets/langs
13-
packages/shikiji/src/assets/themes
14-
packages/shikiji/src/assets/*.json
12+
packages/shiki/src/assets/langs
13+
packages/shiki/src/assets/themes
14+
packages/shiki/src/assets/*.json
1515
cache

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "packages/shikiji-core/vendor/vscode-textmate"]
2-
path = packages/shikiji-core/vendor/vscode-textmate
1+
[submodule "packages/core/vendor/vscode-textmate"]
2+
path = packages/core/vendor/vscode-textmate
33
url = https://github.com/microsoft/vscode-textmate

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@
3737
"jsonc",
3838
"yaml"
3939
],
40-
"references.preferredLocation": "peek"
40+
"references.preferredLocation": "peek",
41+
"cSpell.words": [
42+
"shikijs"
43+
]
4144
}

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Please refer to https://github.com/antfu/contribute
77
This repository contains a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to `vscode-textmate`. By default `git clone` does not clone submodules. To clone this repository and its submodules, use:
88

99
```bash
10-
git clone --recursive https://github.com/antfu/shikiji
10+
git clone --recursive https://github.com/shikijs/shiki
1111
```
1212

1313
Or if you have already cloned it, use:

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<img src="https://raw.githubusercontent.com/antfu/shikiji/main/docs/public/logo.svg" width="150" alt="Shikiji Logo" />
1+
<img src="https://raw.githubusercontent.com/shikijs/shiki/main/docs/public/logo.svg" width="150" alt="Shiki Logo" />
22

3-
# Shikiji 式辞
3+
# Shiki 式
44

5-
[![NPM version](https://img.shields.io/npm/v/shikiji?color=32A9C3&labelColor=1B3C4A&label=npm)](https://www.npmjs.com/package/shikiji)
6-
[![NPM downloads](https://img.shields.io/npm/dm/shikiji?color=32A9C3&labelColor=1B3C4A&label=downloads)](https://www.npmjs.com/package/shikiji)
7-
[![Codecov](https://img.shields.io/codecov/c/github/antfu/shikiji?token=B85J0E2I7I&style=flat&labelColor=1B3C4A&color=32A9C3&precision=1)](https://app.codecov.io/gh/antfu/shikiji)
5+
[![NPM version](https://img.shields.io/npm/v/shiki?color=32A9C3&labelColor=1B3C4A&label=npm)](https://www.npmjs.com/package/shiki)
6+
[![NPM downloads](https://img.shields.io/npm/dm/shiki?color=32A9C3&labelColor=1B3C4A&label=downloads)](https://www.npmjs.com/package/shiki)
7+
[![Codecov](https://img.shields.io/codecov/c/github/shikijs/shiki?token=B85J0E2I7I&style=flat&labelColor=1B3C4A&color=32A9C3&precision=1)](https://app.codecov.io/gh/shikijs/shiki)
88

9-
An ESM-focused rewrite of [shiki](https://github.com/shikijs/shiki), a beautiful syntax highlighter based on TextMate grammars, with more features and capabilities.
9+
A beautiful syntax highlighter based on TextMate grammars, accurate and powerful.
1010

11-
[📚 **Documentation**](https://shikiji.netlify.app)
11+
[📚 **Documentation**](https://shiki.netlify.app)
1212

1313
## License
1414

docs/.vitepress/components/Badges.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ defineProps<{
88
<p flex="~ gap-2" h-5>
99
<a :href="`https://www.npmjs.com/package/${name}`" target="_blank"><img :src="`https://img.shields.io/npm/v/${name}?color=32A9C3&amp;labelColor=1B3C4A&amp;label=npm`" alt="NPM version"></a>
1010
<a :href="`https://www.npmjs.com/package/${name}`" target="_blank"><img :src="`https://img.shields.io/npm/dm/${name}?color=32A9C3&amp;labelColor=1B3C4A&amp;label=downloads`" alt="NPM downloads"></a>
11-
<a :href="`https://github.com/antfu/shikiji/tree/main/packages/${name}`" target="_blank"><img src="https://img.shields.io/badge/source-a?logo=github&color=1B3C4A" alt="GitHub"></a>
11+
<a :href="`https://github.com/shikijs/shiki/tree/main/packages/${name}`" target="_blank"><img src="https://img.shields.io/badge/source-a?logo=github&color=1B3C4A" alt="GitHub"></a>
1212
</p>
1313
</template>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
22
<div class="container max-w-250 mx-a my-10 min-h-250 vp-doc p4" of-hidden>
3-
<ShikijiMiniPlayground />
3+
<ShikiMiniPlayground />
44
</div>
55
</template>

docs/.vitepress/components/LanguagesList.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const langs = computed(() => {
6262
</table>
6363
<div v-if="showModel" fixed inset-0 z-100 flex items-center justify-center>
6464
<div bg-black:50 absolute inset-0 backdrop-blur-sm @click="showModel = false" />
65-
<ShikijiMiniPlayground max-h-80vh w-full md:w-150 lg:w-200 />
65+
<ShikiMiniPlayground max-h-80vh w-full md:w-150 lg:w-200 />
6666
</div>
6767
</div>
6868
</template>

docs/.vitepress/components/ShikijiPlayground.vue docs/.vitepress/components/ShikiPlayground.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const play = usePlayground()
88
<div class="vp-doc">
99
<div grid="~ cols-2 gap-4" p4>
1010
<textarea v-model="play.input" font-mono rounded p4 my4.5 />
11-
<ShikijiMiniPlayground />
11+
<ShikiMiniPlayground />
1212
</div>
1313
</div>
1414
</template>

docs/.vitepress/components/ThemesList.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function preview(id: string) {
4141
</table>
4242
<div v-if="showModel" fixed inset-0 z-100 flex items-center justify-center>
4343
<div bg-black:50 absolute inset-0 backdrop-blur-sm @click="showModel = false" />
44-
<ShikijiMiniPlayground max-h-80vh w-full md:w-150 lg:w-200 />
44+
<ShikiMiniPlayground max-h-80vh w-full md:w-150 lg:w-200 />
4545
</div>
4646
</div>
4747
</template>

docs/.vitepress/config.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { DefaultTheme } from 'vitepress'
22
import { defineConfig } from 'vitepress'
3-
import { bundledThemes } from 'shikiji'
4-
import { transformerMetaWordHighlight, transformerNotationWordHighlight } from '../../packages/shikiji-transformers/src'
5-
import { defaultHoverInfoProcessor, transformerTwoslash } from '../../packages/vitepress-plugin-twoslash/src/index'
3+
import { bundledThemes } from 'shiki'
4+
import { transformerMetaWordHighlight, transformerNotationWordHighlight } from '../../packages/transformers/src'
5+
import { defaultHoverInfoProcessor, transformerTwoslash } from '../../packages/vitepress-twoslash/src/index'
66
import { version } from '../../package.json'
77
import vite from './vite.config'
88

@@ -36,30 +36,30 @@ const INTEGRATIONS: DefaultTheme.NavItemWithLink[] = [
3636

3737
const VERSIONS: DefaultTheme.NavItemWithLink[] = [
3838
{ text: `v${version} (current)`, link: '/' },
39-
{ text: `Release Notes`, link: 'https://github.com/antfu/shikiji/releases' },
40-
{ text: `Contributing`, link: 'https://github.com/antfu/shikiji/blob/main/CONTRIBUTING.md' },
39+
{ text: `Release Notes`, link: 'https://github.com/shikijs/shiki/releases' },
40+
{ text: `Contributing`, link: 'https://github.com/shikijs/shiki/blob/main/CONTRIBUTING.md' },
4141
]
4242

4343
// https://vitepress.dev/reference/site-config
4444
export default defineConfig({
45-
title: 'Shikiji',
45+
title: 'Shiki',
4646
description: 'A beautiful and powerful syntax highlighter',
4747
markdown: {
4848
theme: {
4949
light: 'vitesse-light',
5050
dark: 'vitesse-dark',
5151
},
52-
async shikijiSetup(shikiji) {
52+
async shikijiSetup(shiki) {
5353
await Promise.all(Object.keys(bundledThemes).map(async (theme) => {
54-
await shikiji.loadTheme(theme as any)
54+
await shiki.loadTheme(theme as any)
5555
}))
5656
},
5757
codeTransformers: [
5858
transformerMetaWordHighlight(),
5959
transformerNotationWordHighlight(),
6060
{
6161
// Render custom themes with codeblocks
62-
name: 'shikiji:inline-theme',
62+
name: 'shiki:inline-theme',
6363
preprocess(code, options) {
6464
const reg = /\btheme:([\w,-]+)\b/
6565
const match = options.meta?.__raw?.match(reg)
@@ -93,14 +93,14 @@ export default defineConfig({
9393
transformerTwoslash({
9494
processHoverInfo(info) {
9595
return defaultHoverInfoProcessor(info)
96-
// Remove shikiji_core namespace
97-
.replace(/shikiji_core\./g, '')
96+
// Remove shiki_core namespace
97+
.replace(/shiki_core\./g, '')
9898
// Remove member access
9999
.replace(/^[a-zA-Z0-9_]*(\<[^\>]*\>)?\./, '')
100100
},
101101
}),
102102
{
103-
name: 'shikiji:remove-escape',
103+
name: 'shiki:remove-escape',
104104
postprocess(code) {
105105
return code.replace(/\[\\\!code/g, '[!code')
106106
},
@@ -160,15 +160,15 @@ export default defineConfig({
160160
),
161161

162162
editLink: {
163-
pattern: 'https://github.com/antfu/shikiji/edit/main/docs/:path',
163+
pattern: 'https://github.com/shikijs/shiki/edit/main/docs/:path',
164164
text: 'Suggest changes to this page',
165165
},
166166
search: {
167167
provider: 'local',
168168
},
169169

170170
socialLinks: [
171-
{ icon: 'github', link: 'https://github.com/antfu/shikiji' },
171+
{ icon: 'github', link: 'https://github.com/shikijs/shiki' },
172172
],
173173

174174
footer: {
@@ -181,11 +181,11 @@ export default defineConfig({
181181
['meta', { name: 'theme-color', content: '#ffffff' }],
182182
['link', { rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }],
183183
['meta', { name: 'author', content: 'Pine Wu, Anthony Fu' }],
184-
['meta', { property: 'og:title', content: 'Shikiji' }],
185-
['meta', { property: 'og:image', content: 'https://shikiji.netlify.app/og.png' }],
184+
['meta', { property: 'og:title', content: 'Shiki' }],
185+
['meta', { property: 'og:image', content: 'https://shiki.netlify.app/og.png' }],
186186
['meta', { property: 'og:description', content: 'A beautiful and powerful syntax highlighter' }],
187187
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
188-
['meta', { name: 'twitter:image', content: 'https://shikiji.netlify.app/og.png' }],
188+
['meta', { name: 'twitter:image', content: 'https://shiki.netlify.app/og.png' }],
189189
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0, viewport-fit=cover' }],
190190
],
191191
})

docs/.vitepress/store/playground.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/// <reference types="vite/client" />
22

33
import { acceptHMRUpdate, defineStore } from 'pinia'
4-
import type { BundledLanguageInfo, BundledThemeInfo } from 'shikiji'
4+
import type { BundledLanguageInfo, BundledThemeInfo } from 'shiki'
55
import { useLocalStorage } from '@vueuse/core'
66
import { ref, shallowRef, watch } from 'vue'
77

88
export const usePlayground = defineStore('playground', () => {
9-
const lang = useLocalStorage('shikiji-playground-lang', 'typescript')
10-
const theme = useLocalStorage('shikiji-playground-theme', 'vitesse-dark')
9+
const lang = useLocalStorage('shiki-playground-lang', 'typescript')
10+
const theme = useLocalStorage('shiki-playground-theme', 'vitesse-dark')
1111
const allThemes = shallowRef<BundledThemeInfo[]>([
1212
{
1313
id: 'vitesse-dark',
@@ -26,7 +26,7 @@ export const usePlayground = defineStore('playground', () => {
2626
const bundledLangsFull = shallowRef<BundledLanguageInfo[]>([])
2727
const bundledLangsWeb = shallowRef<BundledLanguageInfo[]>([])
2828

29-
const input = useLocalStorage('shikiji-playground-input', '')
29+
const input = useLocalStorage('shiki-playground-input', '')
3030
const output = ref('<pre></pre>')
3131
const preStyle = ref('')
3232
const isLoading = ref(true)
@@ -39,10 +39,10 @@ export const usePlayground = defineStore('playground', () => {
3939
}
4040

4141
;(async () => {
42-
const { getHighlighter, addClassToHast } = await import('shikiji')
43-
const { bundledLanguagesInfo: bundleFull } = await import('shikiji/bundle/full')
44-
const { bundledLanguagesInfo: bundleWeb } = await import('shikiji/bundle/web')
45-
const { bundledThemesInfo } = await import('shikiji/themes')
42+
const { getHighlighter, addClassToHast } = await import('shiki')
43+
const { bundledLanguagesInfo: bundleFull } = await import('shiki/bundle/full')
44+
const { bundledLanguagesInfo: bundleWeb } = await import('shiki/bundle/web')
45+
const { bundledThemesInfo } = await import('shiki/themes')
4646

4747
const samplesCache = new Map<string, Promise<string | undefined>>()
4848

docs/.vitepress/theme/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import Theme from 'vitepress/theme'
33
import type { EnhanceAppContext } from 'vitepress'
44
import { createPinia } from 'pinia'
5-
import TwoslashFloatingVue from '../../../packages/vitepress-plugin-twoslash/src/client'
5+
import TwoslashFloatingVue from '../../../packages/vitepress-twoslash/src/client'
66

7-
import '../../../packages/shikiji-twoslash/style-rich.css'
7+
import '../../../packages/twoslash/style-rich.css'
88
import 'floating-vue/dist/style.css'
9-
import '../../../packages/vitepress-plugin-twoslash/src/style.css'
9+
import '../../../packages/vitepress-twoslash/src/style.css'
1010
import 'uno.css'
1111
import './style.css'
1212
import './transformers.css'

docs/components.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ declare module 'vue' {
1010
Badges: typeof import('./.vitepress/components/Badges.vue')['default']
1111
HomeDemo: typeof import('./.vitepress/components/HomeDemo.vue')['default']
1212
LanguagesList: typeof import('./.vitepress/components/LanguagesList.vue')['default']
13-
ShikijiMiniPlayground: typeof import('./.vitepress/components/ShikijiMiniPlayground.vue')['default']
14-
ShikijiPlayground: typeof import('./.vitepress/components/ShikijiPlayground.vue')['default']
13+
ShikiMiniPlayground: typeof import('./.vitepress/components/ShikiMiniPlayground.vue')['default']
14+
ShikiPlayground: typeof import('./.vitepress/components/ShikiPlayground.vue')['default']
1515
ThemesList: typeof import('./.vitepress/components/ThemesList.vue')['default']
1616
}
1717
}

docs/guide/bundles.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ outline: deep
44

55
# Bundles
66

7-
The main `shikiji` entries bundles all supported themes and languages via lazy dynamic imports. The efficiency shouldn't be a concern to most of the scenarios as the grammar would only be imported/downloaded when it is used. However, when you bundle Shikiji into browsers runtime or web workers, even those files are not imported, they still add up to your dist size. We provide the [fine-grained bundle](/guide/install#fine-grained-bundle) to help you compose languages and themes one-by-one as you need.
7+
The main `shiki` entries bundles all supported themes and languages via lazy dynamic imports. The efficiency shouldn't be a concern to most of the scenarios as the grammar would only be imported/downloaded when it is used. However, when you bundle Shiki into browsers runtime or web workers, even those files are not imported, they still add up to your dist size. We provide the [fine-grained bundle](/guide/install#fine-grained-bundle) to help you compose languages and themes one-by-one as you need.
88

99
To make it easier, we also provide some pre-composed bundles for you to use:
1010

11-
## `shikiji/bundle/full`
11+
## `shiki/bundle/full`
1212

1313
> [Bundle Size](/guide/#bundle-size): 6.4 MB (minified), 1.2 MB (gzip), async chunks included
1414
15-
The full bundle includes all themes and languages, same as the main `shikiji` entry.
15+
The full bundle includes all themes and languages, same as the main `shiki` entry.
1616

17-
## `shikiji/bundle/web`
17+
## `shiki/bundle/web`
1818

1919
> [Bundle Size](/guide/#bundle-size): 3.8 MB (minified), 695 KB (gzip), async chunks included
2020
2121
The bundle includes all themes and common web languages like (HTML, CSS, JS, TS, JSON, Markdown, etc.) and some web frameworks (Vue, JSX, Svelte, etc.).
2222

23-
Use as normal, all functions from `shikiji` are also available in the bundle:
23+
Use as normal, all functions from `shiki` are also available in the bundle:
2424

2525
```ts twoslash
2626
import {
2727
BundledLanguage,
2828
BundledTheme,
2929
codeToHtml,
3030
getHighlighter
31-
} from 'shikiji/bundle/web' // [!code highlight]
31+
} from 'shiki/bundle/web' // [!code highlight]
3232
3333
const highlighter = await getHighlighter({
3434
langs: ['html', 'css', 'js'],

docs/guide/compat.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@ outline: deep
66

77
We took the chance of the rewrite to make some breaking changes that we think are beneficial for the future. We'd suggest you try to migrate those changes if possible, as most of them should be straightforward. If you have very deep integration, you can try our compatibility build which aligns better with `shiki`'s current API.
88

9-
## Install `shikiji-compat`
9+
## Install `shiki-compat`
1010

11-
<Badges name="shikiji-compat" />
11+
<Badges name="shiki-compat" />
1212

1313
Set the alias to `shiki` in your `package.json`:
1414

1515
```json
1616
{
1717
"dependencies": {
18-
"shiki": "npm:shikiji-compat@0.9"
18+
"shiki": "npm:shiki-compat@0.9"
1919
}
2020
}
2121
```
2222

2323
## Breaking Changes from Shiki
2424

25-
Compare to [`shiki@0.14.3`](https://github.com/shikijs/shiki/releases/tag/v0.14.3), the breaking changes between Shiki and Shikiji are:
25+
Compare to [`shiki@0.14.3`](https://github.com/shikijs/shiki/releases/tag/v0.14.3), the breaking changes between Shiki and Shiki are:
2626

2727
### Hard Breaking Changes
2828

29-
Breaking changes applied to both `shikiji` and `shikiji-compat`:
29+
Breaking changes applied to both `shiki` and `shiki-compat`:
3030

3131
- CJS and IIFE builds are dropped. See [CJS Usage](/guide/install#cjs-usage) and [CDN Usage](/guide/install#cdn-usage) for more details.
3232
- `codeToHtml` uses [`hast`](https://github.com/syntax-tree/hast) internally. The generated HTML will be a bit different but should behave the same.
3333
- `css-variables` theme is not supported. Use the [dual themes](/guide/dual-themes) approach instead, or learn more at the [Theme Colors Manipulation](/guide/theme-colors) page.
3434

3535
### Soft Breaking Changes
3636

37-
Breaking changes applies to `shikiji`, but are shimmed by `shikiji-compat`:
37+
Breaking changes applies to `shiki`, but are shimmed by `shiki-compat`:
3838

3939
- Top-level named exports `setCDN`, `loadLanguage`, `loadTheme`, `setWasm` are dropped as they are not needed anymore.
40-
- `BUNDLED_LANGUAGES`, `BUNDLED_THEMES` are moved to `shikiji/langs` and `shikiji/themes` and renamed to `bundledLanguages` and `bundledThemes` respectively.
40+
- `BUNDLED_LANGUAGES`, `BUNDLED_THEMES` are moved to `shiki/langs` and `shiki/themes` and renamed to `bundledLanguages` and `bundledThemes` respectively.
4141
- `theme` option for `getHighlighter` is dropped, use `themes` with an array instead.
4242
- Highlighter does not maintain an internal default theme context. `theme` option is required for `codeToHtml` and `codeToThemedTokens`.
4343
- `codeToThemedTokens` sets `includeExplanation` to `false` by default.

0 commit comments

Comments
 (0)