mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-16 22:55:03 +00:00
Merge 7770b3e82c
into eb5fda8d19
This commit is contained in:
commit
93606a07f1
4 changed files with 14 additions and 3 deletions
|
@ -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>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
elem.parentNode.classList.add('codeblock');
|
elem.parentNode.classList.add('codeblock');
|
||||||
}
|
}
|
||||||
|
|
||||||
hljs.highlightBlock(elem);
|
hljs.highlightElement(elem);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
10
dashboard/src/directives/highlightjs.ts
Normal file
10
dashboard/src/directives/highlightjs.ts
Normal 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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
|
@ -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";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue