Sharkey/packages/frontend/src/components/MkCode.vue
かっこかり 1a8243f1ca
MkCodeのパースエンジンをShikiに変更 (#12102)
* (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 <Syuilotan@yahoo.co.jp>
2023-10-29 14:12:40 +09:00

39 lines
897 B
Vue

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<Suspense>
<template #fallback>
<MkLoading v-if="!inline ?? true" />
</template>
<code v-if="inline" :class="$style.codeInlineRoot">{{ code }}</code>
<XCode v-else :code="code" :lang="lang"/>
</Suspense>
</template>
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import MkLoading from '@/components/global/MkLoading.vue';
defineProps<{
code: string;
lang?: string;
inline?: boolean;
}>();
const XCode = defineAsyncComponent(() => import('@/components/MkCode.core.vue'));
</script>
<style module lang="scss">
.codeInlineRoot {
display: inline-block;
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
overflow-wrap: anywhere;
color: #D4D4D4;
background: #1E1E1E;
padding: .1em;
border-radius: .3em;
}
</style>