summaryrefslogtreecommitdiff
path: root/src/client/components/code-core.vue
diff options
context:
space:
mode:
authortakonomura <takonomura@users.noreply.github.com>2020-10-19 08:37:07 +0900
committerGitHub <noreply@github.com>2020-10-19 08:37:07 +0900
commit059aeef6a095df37109a3cf560850afd7a760913 (patch)
tree70b67c5e3f3b53a2052f71230298d6ad533fbb3b /src/client/components/code-core.vue
parentUpdate settings.vue (#6742) (diff)
downloadsharkey-059aeef6a095df37109a3cf560850afd7a760913.tar.gz
sharkey-059aeef6a095df37109a3cf560850afd7a760913.tar.bz2
sharkey-059aeef6a095df37109a3cf560850afd7a760913.zip
MFM のバッククオートで囲ったコードが表示されないのを修正 (#6741)
Diffstat (limited to 'src/client/components/code-core.vue')
-rw-r--r--src/client/components/code-core.vue10
1 files changed, 5 insertions, 5 deletions
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);
}
}
});