Skip to content
Permalink
Browse files

enable syntax highlighting using highlight.js

  • Loading branch information...
okonomi committed Jun 15, 2019
1 parent be4f8c8 commit e5835bcc663a13373ab86ca63fe19c4507972885
Showing with 16 additions and 1 deletion.
  1. +2 −1 app/javascript/packs/application.js
  2. +8 −0 app/javascript/src/highlight.js
  3. +1 −0 package.json
  4. +5 −0 yarn.lock
@@ -16,9 +16,10 @@ require("@rails/actiontext")
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

import 'bulma/css/bulma'
import 'bulma'
import '@fortawesome/fontawesome-free/css/all.css'

import '../src/bulma-navbar'
import '../src/bulma-notification'
import '../src/trix'
import '../src/highlight'
@@ -0,0 +1,8 @@
import hljs from 'highlight.js'
import 'highlight.js/styles/default.css'

document.addEventListener('turbolinks:load', () => {
document.querySelectorAll('pre').forEach(block => {
hljs.highlightBlock(block)
})
})
@@ -9,6 +9,7 @@
"@rails/ujs": "^6.0.0-rc1",
"@rails/webpacker": "^4.0.2",
"bulma": "^0.7.4",
"highlight.js": "^9.15.8",
"trix": "^1.0.0",
"turbolinks": "^5.2.0"
},
@@ -3150,6 +3150,11 @@ hex-color-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==

highlight.js@^9.15.8:
version "9.15.8"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.8.tgz#f344fda123f36f1a65490e932cf90569e4999971"
integrity sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA==

hmac-drbg@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"

0 comments on commit e5835bc

Please sign in to comment.
You can’t perform that action at this time.