From 1a8243f1cace06c2eb872177d39536f76c9a8f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sun, 29 Oct 2023 14:12:40 +0900 Subject: [PATCH] =?UTF-8?q?MkCode=E3=81=AE=E3=83=91=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E3=82=92Shiki=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=20(#12102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * (swap) prism -> shiki * fix styles * (bump) aiscript-vscode to v0.0.5 * refactor * replace prism-editor (beta) * Update scratchpad.vue * (enhance) MkCodeEditor自動インデント改行 * (fix) lint * (add) scratchpad: MkStickyContainer * Update CHANGELOG.md * clean up --------- Co-authored-by: syuilo --- CHANGELOG.md | 3 + packages/frontend/package.json | 4 +- .../frontend/src/components/MkCode.core.vue | 85 ++++++++- packages/frontend/src/components/MkCode.vue | 21 ++- .../frontend/src/components/MkCodeEditor.vue | 166 ++++++++++++++++++ packages/frontend/src/pages/flash/flash.vue | 2 +- packages/frontend/src/pages/scratchpad.vue | 60 +++---- .../frontend/src/pages/settings/plugin.vue | 2 +- .../frontend/src/scripts/code-highlighter.ts | 31 ++++ packages/frontend/src/style.scss | 4 - pnpm-lock.yaml | 87 +++++---- scripts/build-assets.mjs | 8 + 12 files changed, 380 insertions(+), 93 deletions(-) create mode 100644 packages/frontend/src/components/MkCodeEditor.vue create mode 100644 packages/frontend/src/scripts/code-highlighter.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index aa65bf813..b909b26ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ - Feat: プラグイン・テーマを外部サイトから直接インストールできるようになりました - 外部サイトでの実装が必要です。詳細は Misskey Hub をご覧ください https://misskey-hub.net/docs/advanced/publish-on-your-website.html +- Enhance: コードのシンタックスハイライトエンジンをShikiに変更 + - AiScriptのシンタックスハイライトに対応 + - MFMでAiScriptをハイライトする場合、コードブロックの開始部分を ` ```is ` もしくは ` ```aiscript ` としてください - Enhance: データセーバー有効時はアニメーション付きのアバター画像が停止するように - Enhance: プラグインを削除した際には、使用されていたアクセストークンも同時に削除されるようになりました - Enhance: プラグインで`Plugin:register_note_view_interruptor`を用いてnoteの代わりにnullを返却することでノートを非表示にできるようになりました diff --git a/packages/frontend/package.json b/packages/frontend/package.json index f8492b3e5..fe35519d2 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -29,6 +29,7 @@ "@vue/compiler-sfc": "3.3.7", "astring": "1.8.6", "autosize": "6.0.1", + "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.0.5", "broadcast-channel": "5.5.1", "browser-image-resizer": "github:misskey-dev/browser-image-resizer#v2.2.1-misskey.3", "buraha": "0.0.1", @@ -54,11 +55,11 @@ "mfm-js": "0.23.3", "misskey-js": "workspace:*", "photoswipe": "5.4.2", - "prismjs": "1.29.0", "punycode": "2.3.0", "querystring": "0.2.1", "rollup": "4.1.4", "sanitize-html": "2.11.0", + "shiki": "^0.14.5", "sass": "1.69.5", "strict-event-emitter-types": "2.0.0", "textarea-caret": "3.1.0", @@ -74,7 +75,6 @@ "vanilla-tilt": "1.8.1", "vite": "4.5.0", "vue": "3.3.7", - "vue-prism-editor": "2.0.0-alpha.2", "vuedraggable": "next" }, "devDependencies": { diff --git a/packages/frontend/src/components/MkCode.core.vue b/packages/frontend/src/components/MkCode.core.vue index a1300be1f..4ec354041 100644 --- a/packages/frontend/src/components/MkCode.core.vue +++ b/packages/frontend/src/components/MkCode.core.vue @@ -5,21 +5,90 @@ SPDX-License-Identifier: AGPL-3.0-only + + diff --git a/packages/frontend/src/components/MkCode.vue b/packages/frontend/src/components/MkCode.vue index 8972b1863..b39e6ff23 100644 --- a/packages/frontend/src/components/MkCode.vue +++ b/packages/frontend/src/components/MkCode.vue @@ -4,11 +4,18 @@ SPDX-License-Identifier: AGPL-3.0-only --> + + diff --git a/packages/frontend/src/components/MkCodeEditor.vue b/packages/frontend/src/components/MkCodeEditor.vue new file mode 100644 index 000000000..2d56a6196 --- /dev/null +++ b/packages/frontend/src/components/MkCodeEditor.vue @@ -0,0 +1,166 @@ + + + + + + + diff --git a/packages/frontend/src/pages/flash/flash.vue b/packages/frontend/src/pages/flash/flash.vue index 32a835831..ebf117ffb 100644 --- a/packages/frontend/src/pages/flash/flash.vue +++ b/packages/frontend/src/pages/flash/flash.vue @@ -36,7 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only - +
diff --git a/packages/frontend/src/pages/scratchpad.vue b/packages/frontend/src/pages/scratchpad.vue index 3dfd2d661..f8d3187bd 100644 --- a/packages/frontend/src/pages/scratchpad.vue +++ b/packages/frontend/src/pages/scratchpad.vue @@ -4,46 +4,46 @@ SPDX-License-Identifier: AGPL-3.0-only -->