Improve syntax highlighting

This commit is contained in:
Oliver Davies 2020-12-16 23:52:30 +00:00
parent 832b2897f3
commit 265b6f17ca
4 changed files with 20 additions and 9 deletions

View file

@ -4,7 +4,6 @@
@import 'tailwindcss/components';
@import './custom-components.pcss';
@import 'highlightjs/styles/github-gist';
@import './libraries/hljs.pcss';
@import 'tailwindcss/utilities';

View file

@ -1,7 +1,20 @@
import 'alpinejs'
import 'focus-visible'
import 'styles/tailwind.pcss'
import hljs from 'highlightjs'
import hljs from 'highlight.js/lib/core'
import 'highlight.js/styles/hybrid.css'
import bash from 'highlight.js/lib/languages/bash'
import ini from 'highlight.js/lib/languages/ini'
import javascript from 'highlight.js/lib/languages/javascript'
import php from 'highlight.js/lib/languages/php'
import yaml from 'highlight.js/lib/languages/yaml'
hljs.registerLanguage('bash', bash);
hljs.registerLanguage('ini', ini);
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('php', php);
hljs.registerLanguage('yaml', yaml);
document.addEventListener('DOMContentLoaded', event => {
document.querySelectorAll('pre code').forEach(block => {

View file

@ -4488,11 +4488,10 @@
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==",
"dev": true
},
"highlightjs": {
"version": "9.16.2",
"resolved": "https://registry.npmjs.org/highlightjs/-/highlightjs-9.16.2.tgz",
"integrity": "sha512-FK1vmMj8BbEipEy8DLIvp71t5UsC7n2D6En/UfM/91PCwmOpj6f2iu0Y0coRC62KSRHHC+dquM2xMULV/X7NFg==",
"dev": true
"highlight.js": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz",
"integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg=="
},
"hmac-drbg": {
"version": "1.0.1",

View file

@ -13,7 +13,6 @@
"alpinejs": "^2.3.5",
"autoprefixer": "^9.8.0",
"elliptic": ">=6.5.3",
"highlightjs": "^9.16.2",
"lodash": ">=4.17.19",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
@ -22,6 +21,7 @@
"webpack-notifier": "^1.8.0"
},
"dependencies": {
"focus-visible": "^5.1.0"
"focus-visible": "^5.1.0",
"highlight.js": "^10.4.1"
}
}