diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-01-30 04:37:25 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-30 04:37:25 +0900 |
| commit | f6154dc0af1a0d65819e87240f4385f9573095cb (patch) | |
| tree | 699a5ca07d6727b7f8497d4769f25d6d62f94b5a /src/client/components/code-core.vue | |
| parent | Add Event activity-type support (#5785) (diff) | |
| download | sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.gz sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.tar.bz2 sharkey-f6154dc0af1a0d65819e87240f4385f9573095cb.zip | |
v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
Diffstat (limited to 'src/client/components/code-core.vue')
| -rw-r--r-- | src/client/components/code-core.vue | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/client/components/code-core.vue b/src/client/components/code-core.vue new file mode 100644 index 0000000000..a9253528d9 --- /dev/null +++ b/src/client/components/code-core.vue @@ -0,0 +1,34 @@ +<template> +<x-prism :inline="inline" :language="prismLang">{{ code }}</x-prism> +</template> + +<script lang="ts"> +import Vue from 'vue'; +import 'prismjs'; +import 'prismjs/themes/prism-okaidia.css'; +import XPrism from 'vue-prism-component'; +export default Vue.extend({ + components: { + XPrism + }, + props: { + code: { + type: String, + required: true + }, + lang: { + type: String, + required: false + }, + inline: { + type: Boolean, + required: false + } + }, + computed: { + prismLang() { + return Prism.languages[this.lang] ? this.lang : 'js'; + } + } +}); +</script> |