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
6 years ago
|
const hljs = require('highlight.js')
|
||
|
|
||
|
module.exports = {
|
||
|
async init($, config) {
|
||
|
$('pre > code').each((idx, elm) => {
|
||
6 years ago
|
const codeClasses = $(elm).attr('class') || ''
|
||
|
if (codeClasses.indexOf('language-') < 0) {
|
||
6 years ago
|
const result = hljs.highlightAuto($(elm).text())
|
||
6 years ago
|
$(elm).addClass('language-', result.language)
|
||
6 years ago
|
}
|
||
6 years ago
|
$(elm).parent().addClass('prismjs line-numbers')
|
||
6 years ago
|
})
|
||
|
}
|
||
|
}
|