enhance(frontend): シンタックスハイライトのエンジンをJavaScriptベースのものに変更 (#16084)

* refactor(frontend): シンタックスハイライトのエンジンをJavaScriptベースのものに変更

* Update Changelog
This commit is contained in:
かっこかり 2025-05-22 22:57:04 +09:00 committed by GitHub
parent e6e8bfa591
commit aaee0a788d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -42,6 +42,9 @@
(Based on https://github.com/taiyme/misskey/pull/198, https://github.com/taiyme/misskey/pull/211, https://github.com/taiyme/misskey/pull/283)
- Enhance: ユーザー設定でURLプレビューを無効化できるように
- Enhance: AiScriptからtoastを表示する関数 `Mk:toast` を追加
- Enhance: シンタックスハイライトのエンジンをJavaScriptベースのものに変更
- フロントエンドの読み込みサイズを軽量化しました
- ほとんどの言語のハイライトは問題なく行えますが、互換性の問題により一部の言語が正常にハイライトできなくなる可能性があります。詳しくは https://shiki.style/references/engine-js-compat をご覧ください。
- Fix: "時計"ウィジェット(Clock)において、Transparent設定が有効でも、その背景が透過されない問題を修正
### Server

View File

@ -4,7 +4,7 @@
*/
import { createHighlighterCore } from 'shiki/core';
import { createOnigurumaEngine } from 'shiki/engine/oniguruma';
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
import darkPlus from 'shiki/themes/dark-plus.mjs';
import { bundledThemesInfo } from 'shiki/themes';
import { bundledLanguagesInfo } from 'shiki/langs';
@ -71,7 +71,7 @@ async function initHighlighter() {
const jsLangInfo = bundledLanguagesInfo.find(t => t.id === 'javascript');
const highlighter = await createHighlighterCore({
engine: createOnigurumaEngine(() => import('shiki/onig.wasm?init')),
engine: createJavaScriptRegexEngine({ forgiving: true }),
themes,
langs: [
...(jsLangInfo ? [async () => await jsLangInfo.import()] : []),