Skip to content

Commit e0f5f8f

Browse files
committed
feat: preset code
1 parent c8f9a68 commit e0f5f8f

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@coze-editor/preset-code",
5+
"comment": "preset code",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@coze-editor/preset-code",
10+
"email": "[email protected]"
11+
}

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/text-editor/preset-code/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"@coze-editor/vscode": "workspace:*",
3737
"@lezer/highlight": "~1.2.0",
3838
"@nozbe/microfuzz": "^1.0.0",
39+
"@shikijs/langs": "~3.12.0",
40+
"@shikijs/themes": "~3.12.0",
3941
"codemirror-shiki": "^0.2.2",
4042
"marked": "^15.0.7",
4143
"marked-shiki": "^1.2.0",
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
// Copyright (c) 2025 coze-dev
22
// SPDX-License-Identifier: MIT
33

4-
import { createHighlighter } from 'shiki';
4+
import { createOnigurumaEngine } from 'shiki/engine/oniguruma';
5+
import { createHighlighterCore } from 'shiki/core';
56

6-
const highlighterPromise = createHighlighter({
7-
langs: ['md', 'js', 'ts', 'python'],
8-
themes: ['github-dark', 'one-dark-pro'],
7+
// const highlighterPromise = createHighlighter({
8+
// langs: ['md', 'js', 'ts', 'python'],
9+
// themes: ['github-dark', 'one-dark-pro'],
10+
// });
11+
12+
const highlighterPromise = createHighlighterCore({
13+
langs: [
14+
() => import('@shikijs/langs/markdown'),
15+
() => import('@shikijs/langs/javascript'),
16+
() => import('@shikijs/langs/typescript'),
17+
() => import('@shikijs/langs/python'),
18+
],
19+
themes: [
20+
() => import('@shikijs/themes/github-dark'),
21+
() => import('@shikijs/themes/one-dark-pro'),
22+
],
23+
engine: createOnigurumaEngine(import('shiki/wasm')),
924
});
1025

1126
export { highlighterPromise };

0 commit comments

Comments
 (0)