From 059aeef6a095df37109a3cf560850afd7a760913 Mon Sep 17 00:00:00 2001 From: takonomura <takonomura@users.noreply.github.com> Date: Mon, 19 Oct 2020 08:37:07 +0900 Subject: [PATCH] =?UTF-8?q?MFM=20=E3=81=AE=E3=83=90=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=AF=E3=82=AA=E3=83=BC=E3=83=88=E3=81=A7=E5=9B=B2=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=82=B3=E3=83=BC=E3=83=89=E3=81=8C=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20(#6741)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - src/client/components/code-core.vue | 10 +++++----- yarn.lock | 5 ----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 78ed2fd760..aa4e6edd70 100644 --- a/package.json +++ b/package.json @@ -246,7 +246,6 @@ "vue-i18n": "9.0.0-beta.4", "vue-json-pretty": "1.7.0", "vue-loader": "16.0.0-beta.7", - "vue-prism-component": "1.2.0", "vue-prism-editor": "1.2.2", "vue-router": "4.0.0-beta.13", "vue-style-loader": "4.1.2", diff --git a/src/client/components/code-core.vue b/src/client/components/code-core.vue index cfb9d47ed9..9cff7b4448 100644 --- a/src/client/components/code-core.vue +++ b/src/client/components/code-core.vue @@ -1,17 +1,14 @@ <template> -<XPrism :inline="inline" :language="prismLang">{{ code }}</XPrism> +<code v-if="inline" v-html="html" :class="`language-${prismLang}`"></code> +<pre v-else :class="`language-${prismLang}`"><code v-html="html" :class="`language-${prismLang}`"></code></pre> </template> <script lang="ts"> import { defineComponent } from 'vue'; import 'prismjs'; import 'prismjs/themes/prism-okaidia.css'; -import XPrism from 'vue-prism-component';import * as os from '@/os'; export default defineComponent({ - components: { - XPrism - }, props: { code: { type: String, @@ -29,6 +26,9 @@ export default defineComponent({ computed: { prismLang() { return Prism.languages[this.lang] ? this.lang : 'js'; + }, + html() { + return Prism.highlight(this.code, Prism.languages[this.prismLang], this.prismLang); } } }); diff --git a/yarn.lock b/yarn.lock index a0bd63379c..2f35a16da8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10401,11 +10401,6 @@ vue-loader@16.0.0-beta.7: merge-source-map "^1.1.0" source-map "^0.6.1" -vue-prism-component@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/vue-prism-component/-/vue-prism-component-1.2.0.tgz#406252e16979def13b5d28827d95b2b6dc647825" - integrity sha512-0N9CNuQu+36CJpdsZHrhdq7d18oBvjVMjawyKdIr8xuzFWLfdxECZQYbFaYoopPBg3SvkEEMtkhYqdgTQl5Y+A== - vue-prism-editor@1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/vue-prism-editor/-/vue-prism-editor-1.2.2.tgz#023cfd4329848f191aac851f2f5e6c7a8c2e059f" -- GitLab