Simply install the npm package
npm install --save vue-hljs-with-line-number
// Import Vue and vue-highlgihtjs;// Tell Vue.js to use vue-hljs-with-line-numberVue
<!-- If your source-code lives in a variable called 'sourcecode' --><!-- If you want to highlight hardcoded source-code -->const s = new Date().toString()
Author: Chris Hager firstname.lastname@example.org (https://www.metachris.com)
- Fix the problem that code block has
- Fix the problem that code block and line number alternately appear.
- Fixed issue that options spell error.
- Fixed issue that single line options spell error.
- Fixed issue that single line rendering abnormal.
- Fixed issue that single line has not line number.
- Fixed lost line number when compnoent updated.
- Since the original author is no longer updating, it needs to fork the warehouse to open another npm package. Add the line-number feature. Line-number feature reference warehouse highlightjs-line-numbers.js Extract and modify part of the code for Vue-compatible processing.