Enabled code highlighting in READMEs via highlight.js

This commit is contained in:
Chris Kankiewicz
2020-02-10 14:09:16 -07:00
parent 0fc2f15479
commit 59abe002ec
5 changed files with 13 additions and 1 deletions

View File

@@ -19,6 +19,9 @@ const app = new Vue({
}
});
let hljs = require('highlight.js');
hljs.initHighlightingOnLoad();
let link = document.getElementById('scroll-to-top');
window.addEventListener('scroll', function() {
if (window.scrollY > 10) {

View File

@@ -9,6 +9,9 @@ $fa-font-path: "./webfonts";
@import "~@fortawesome/fontawesome-free/scss/brands.scss";
@import "~@fortawesome/fontawesome-free/scss/solid.scss";
// Code highlighting
@import "~highlight.js/scss/github.scss";
// Fonts
@import url("https://fonts.googleapis.com/css?family=Source+Code+Pro|Work+Sans:200,400&display=swap");

5
package-lock.json generated
View File

@@ -4926,6 +4926,11 @@
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==",
"dev": true
},
"highlight.js": {
"version": "9.18.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz",
"integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg=="
},
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",

View File

@@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^0.19.2",
"highlight.js": "^9.18.1",
"vue": "^2.6.11"
},
"devDependencies": {

View File

@@ -26,7 +26,7 @@ mix.purgeCss({
extensions: ['html', 'js', 'php', 'scss', 'twig', 'vue'],
folders: ['app'],
whitelist: ['html', 'body', 'main', 'fab', 'far', 'fas'],
whitelistPatterns: [/^fa\-/]
whitelistPatterns: [/^fa\-/, /^hljs/]
});
if (mix.inProduction()) {