Chris Hager
Programming, Technology & More

Vue.Js

RSS Feed

Vue.js Syntax Highlighting with highlight.js

This post explains how to use highlight.js for syntax highlighting in a Vue.js application, allowing highlighting both on creation of an element as well as on updates to the source-code, using a simple v-highlightjs directive.
Everyone loves a good syntax highlighting. This post explains how to use highlight.js for syntax highlighting in a Vue.js application. The method shown here allows syntax highlighting both on original creation of an element as well as on updates to the source-code, using a simple v-highlightjs directive such as this: <pre v-highlightjs><code class="javascript"></code></pre> You can see a live example here: jsfiddle.net/metachris/1vz9oobc. To achieve this, we just need to install the highlight.

swirl