Gathering detailed insights and metrics for vue-highlight.js
Gathering detailed insights and metrics for vue-highlight.js
Gathering detailed insights and metrics for vue-highlight.js
Gathering detailed insights and metrics for vue-highlight.js
vue-highlightjs
Syntax highlighting with highlight.js for Vue.js 2.x
@highlightjs/vue-plugin
Highlight.js Vue Plugin
@wdns/vue-code-block
Vue 3 CodeBlock - Highlight your code with ease using this syntax highlighting component powered by PrismJS or Highlight.js.
vue-meditor
一款使用marked和highlight.js开发的一款markdown编辑器
npm install vue-highlight.js
Typescript
Module System
TypeScript (72.29%)
Vue (27.71%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
209 Stars
214 Commits
24 Forks
3 Watchers
4 Branches
3 Contributors
Updated on Mar 13, 2025
Latest Version
3.1.0
Package Id
vue-highlight.js@3.1.0
Size
63.17 kB
Published on
Mar 02, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
2
22
???? Highlight.js syntax highlighter component for Vue.
Via npm:
1npm install highlight.js vue-highlight.js
Or Yarn:
1yarn add highlight.js vue-highlight.js
Go to https://gluons.github.io/vue-highlight.js
Main file:
There are 2 ways to import Highlight.js languages.
Import only languages that you want.
1import Vue from 'vue'; 2import VueHighlightJS from 'vue-highlight.js'; 3 4// Highlight.js languages (Only required languages) 5import css from 'highlight.js/lib/languages/css'; 6import javascript from 'highlight.js/lib/languages/javascript'; 7import vue from 'vue-highlight.js/lib/languages/vue'; 8 9/* 10* Import Highlight.js theme 11* Find more: https://highlightjs.org/static/demo/ 12*/ 13import 'highlight.js/styles/default.css'; 14 15import App from './App'; 16 17/* 18* Use Vue Highlight.js 19*/ 20Vue.use(VueHighlightJS, { 21 // Register only languages that you want 22 languages: { 23 css, 24 javascript, 25 vue 26 } 27}); 28 29new Vue({ 30 el: '#app', 31 render: h => h(App) 32});
Import all languages.
1import Vue from 'vue'; 2import VueHighlightJS from 'vue-highlight.js'; 3 4// Highlight.js languages (All languages) 5import 'vue-highlight.js/lib/allLanguages' 6 7/* 8* Import Highlight.js theme 9* Find more: https://highlightjs.org/static/demo/ 10*/ 11import 'highlight.js/styles/default.css'; 12 13import App from './App'; 14 15/* 16* Use Vue Highlight.js 17*/ 18Vue.use(VueHighlightJS); 19 20new Vue({ 21 el: '#app', 22 render: h => h(App) 23});
Vue file:
1<template> 2 <div id="app"> 3 <!-- Code Block --> 4 <highlight-code lang="javascript"> 5 let str = 'Hello, World!'; 6 console.log(str); 7 </highlight-code> 8 9 <!-- Inline Code Block --> 10 <highlight-code lang="javascript" inline>alert('Hello, World!');</highlight-code> 11 </div> 12</template> 13 14<script> 15// JavaScript... 16</script> 17 18<style> 19/* StyleSheet... */ 20</style>
languages
Type: { [name: string]: HLJSLang }
Default: {}
Highlight.js languages.
Add the languages that you want to use here.
name
is the name of language to register with Highlight.js' registerLanguage(name, language)
API.
See https://github.com/isagalaev/highlight.js#commonjs about importing each language from highlight.js.
<highlight-code>
Highlight.js code block.
Static code content.
Type: String
Highlight.js language.
Type: Boolean
Default: false
Enable inline code block when set it to true
.
Type: String
Code content in code block.
You can use this prop if you want to bind code content to your data source.
It's useful for dynamic code content.
Component will ignore slot
static content if you use this.
Type: Boolean
Enable auto detecting code language.
Code will be detected by highlight.js'
highlightAuto
function.
auto
will work well when you import all Highlight.js languages.
Component will ignore lang
prop if you use auto
.
How to write HTML code inside slot?
You have to escape all HTML tags before add it into slot.
If you didn't do that, browser will interpret those tags as HTML element.
ℹ️ See isagalaev/highlight.js#866
If you use
code
property instead ofslot
, you don't need to worry about this.
Vue Highlight.js will automatically escape it for you.
Why did I get SyntaxError: Unterminated template literal
error when used <script></script>
in code
property?
If you add </script>
at anywhere inside script
tag, although it's a string
inside quotes, it will always close the script
tag.
ℹ️ See "Unterminated template literal" syntax error when literal contains script tag
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/12 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
112 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More