mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
414 B
15 lines
414 B
const hljs = require('highlight.js')
|
|
|
|
module.exports = {
|
|
async init($, config) {
|
|
$('pre > code').each((idx, elm) => {
|
|
const codeClasses = $(elm).attr('class') || ''
|
|
if (codeClasses.indexOf('language-') < 0) {
|
|
const result = hljs.highlightAuto($(elm).text())
|
|
$(elm).addClass('language-', result.language)
|
|
}
|
|
$(elm).parent().addClass('prismjs line-numbers')
|
|
})
|
|
}
|
|
}
|