3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-16 22:55:03 +00:00
This commit is contained in:
rubyowo 2024-10-19 22:57:10 +04:00 committed by GitHub
commit 93606a07f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<template> <template>
<pre class="codeblock" v-highlightjs><code :class="codeLang" v-trim-indents="trim"><slot></slot></code></pre> <pre class="codeblock"><code :class="codeLang" v-trim-indents="trim" v-highlightjs><slot></slot></code></pre>
</template> </template>
<script> <script>

View file

@ -18,7 +18,7 @@
elem.parentNode.classList.add('codeblock'); elem.parentNode.classList.add('codeblock');
} }
hljs.highlightBlock(elem); hljs.highlightElement(elem);
}); });
} }
}, },

View file

@ -0,0 +1,10 @@
import hljs from "highlight.js/lib/core";
import Vue from "vue";
Vue.directive("highlightjs", {
bind(el, binding) {
if (!el.classList.contains("plain")) {
hljs.highlightElement(el);
}
},
});

View file

@ -4,12 +4,13 @@ import Vue from "vue";
import VueHighlightJS from "@highlightjs/vue-plugin"; import VueHighlightJS from "@highlightjs/vue-plugin";
import hljs from "highlight.js/lib/core"; import hljs from "highlight.js/lib/core";
import hljsYaml from "highlight.js/lib/languages/yaml.js"; import hljsYaml from "highlight.js/lib/languages/yaml";
import "highlight.js/styles/base16/ocean.css"; import "highlight.js/styles/base16/ocean.css";
import { router } from "./routes"; import { router } from "./routes";
import { RootStore } from "./store"; import { RootStore } from "./store";
import "./directives/highlightjs";
import "./directives/trim-indents"; import "./directives/trim-indents";
import App from "./components/App.vue"; import App from "./components/App.vue";