mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-29 23:03:04 +00:00
c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
25 lines
810 B
Vue
25 lines
810 B
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
|
<template>
|
|
<code v-if="inline" :class="`language-${prismLang}`" style="overflow-wrap: anywhere;" v-html="html"></code>
|
|
<pre v-else :class="`language-${prismLang}`"><code :class="`language-${prismLang}`" v-html="html"></code></pre>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue';
|
|
import Prism from 'prismjs';
|
|
import 'prismjs/themes/prism-okaidia.css';
|
|
|
|
const props = defineProps<{
|
|
code: string;
|
|
lang?: string;
|
|
inline?: boolean;
|
|
}>();
|
|
|
|
const prismLang = computed(() => Prism.languages[props.lang] ? props.lang : 'js');
|
|
const html = computed(() => Prism.highlight(props.code, Prism.languages[prismLang.value], prismLang.value));
|
|
</script>
|