MFM のバッククオートで囲ったコードが表示されないのを修正 (#6741)

This commit is contained in:
takonomura 2020-10-19 08:37:07 +09:00 committed by GitHub
parent 4c35e805bd
commit b184dfe463
3 changed files with 5 additions and 11 deletions

View file

@ -246,7 +246,6 @@
"vue-i18n": "9.0.0-beta.4", "vue-i18n": "9.0.0-beta.4",
"vue-json-pretty": "1.7.0", "vue-json-pretty": "1.7.0",
"vue-loader": "16.0.0-beta.7", "vue-loader": "16.0.0-beta.7",
"vue-prism-component": "1.2.0",
"vue-prism-editor": "1.2.2", "vue-prism-editor": "1.2.2",
"vue-router": "4.0.0-beta.13", "vue-router": "4.0.0-beta.13",
"vue-style-loader": "4.1.2", "vue-style-loader": "4.1.2",

View file

@ -1,17 +1,14 @@
<template> <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> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import 'prismjs'; import 'prismjs';
import 'prismjs/themes/prism-okaidia.css'; import 'prismjs/themes/prism-okaidia.css';
import XPrism from 'vue-prism-component';import * as os from '@/os';
export default defineComponent({ export default defineComponent({
components: {
XPrism
},
props: { props: {
code: { code: {
type: String, type: String,
@ -29,6 +26,9 @@ export default defineComponent({
computed: { computed: {
prismLang() { prismLang() {
return Prism.languages[this.lang] ? this.lang : 'js'; return Prism.languages[this.lang] ? this.lang : 'js';
},
html() {
return Prism.highlight(this.code, Prism.languages[this.prismLang], this.prismLang);
} }
} }
}); });

View file

@ -10401,11 +10401,6 @@ vue-loader@16.0.0-beta.7:
merge-source-map "^1.1.0" merge-source-map "^1.1.0"
source-map "^0.6.1" 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: vue-prism-editor@1.2.2:
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/vue-prism-editor/-/vue-prism-editor-1.2.2.tgz#023cfd4329848f191aac851f2f5e6c7a8c2e059f" resolved "https://registry.yarnpkg.com/vue-prism-editor/-/vue-prism-editor-1.2.2.tgz#023cfd4329848f191aac851f2f5e6c7a8c2e059f"