From 786b150ea75111b5f6102c256d5cfa42cb83d1fb Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Wed, 31 Aug 2022 00:24:33 +0900
Subject: refactor(client): align filename to component name

---
 packages/client/src/components/MkCode.core.vue | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 packages/client/src/components/MkCode.core.vue

(limited to 'packages/client/src/components/MkCode.core.vue')

diff --git a/packages/client/src/components/MkCode.core.vue b/packages/client/src/components/MkCode.core.vue
new file mode 100644
index 0000000000..b074028821
--- /dev/null
+++ b/packages/client/src/components/MkCode.core.vue
@@ -0,0 +1,20 @@
+<!-- eslint-disable vue/no-v-html -->
+<template>
+<code v-if="inline" :class="`language-${prismLang}`" 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>
-- 
cgit v1.2.3-freya

