vue-highlight.js
Opened this issue · 2 comments
Asi jsem idiot, na lokale se mi to nepovedlo rozchodit.
sel jsem na to takhle:
npm install --save vue-highlightjs
pak jsem do main.js pridal:
import VueHighlightJS from "vue-highlightjs"
// Highlight.js languages (Only sql)
import sql from 'highlight.js/lib/languages/sql'
import javascript from 'highlight.js/lib/languages/javascript'
Vue.config.productionTip = false
Vue.use(VueHighlightJS, {
// Register only languages that we need
languages: {
sql,
javascript
}
})
a do tahak vue zkousel pridat
<highlight-code lang="sql"> Select * from terror where nkillter > 0; </highlight-code>
i
<pre v-highlightjs><code class="sql"> Select * from terror where nkillter > 0; </code></pre>
ale bez uspechu, pise mi to 'Unknown custom element: - did you register the component correctly?'
aha, tak stacilo pridat require na cssko
zatim to mam na prasaka : require('../node_modules/highlight.js/styles/ir-black.css')
commitnuto, jen bude potreba do dependencies narvat vue-highlightjs a asi do assets vrazit ten ir-black.css, protoze ten je soucasti highlight.js, v tom vue-highlight jsem styly nenasel...