Skip to content
Snippets Groups Projects
Commit fde94cfa authored by Martin Mareš's avatar Martin Mareš
Browse files

Enable highlighting of code blocks using highlight.js

parent 5fc3aa93
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ install: .allow-install
js: js/package-lock.json
( cd js && node_modules/.bin/browserify -o ../static/bundle.js owl.js --standalone owl --plugin tinyify )
cp js/node_modules/katex/dist/katex.min.css static/
cp js/node_modules/highlight.js/styles/github.css static/
rm -rf static/fonts && cp -a js/node_modules/katex-fonts/fonts static/
js/package-lock.json: js/package.json
......
var md = require('markdown-it')()
var mk = require('markdown-it-katexx')
const md = require('markdown-it')()
md.set({
html: false,
typographer: true,
});
})
const mk = require('markdown-it-katexx')
md.use(mk);
md.use(mk)
const hljs = require('highlight.js/lib/core')
hljs.registerLanguage('plaintext', require('highlight.js/lib/languages/plaintext'))
hljs.registerLanguage('c', require('highlight.js/lib/languages/c'))
hljs.registerLanguage('cpp', require('highlight.js/lib/languages/cpp'))
hljs.registerLanguage('python', require('highlight.js/lib/languages/python'))
hljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell'))
hljs.registerLanguage('prolog', require('highlight.js/lib/languages/prolog'))
const mhl = require('markdown-it-highlightjs/core')
md.use(mhl, {
auto: false,
code: true,
inline: false,
hljs: hljs,
});
exports.render_md = function () {
console.log('Owl: Rendering Markdown');
......
......@@ -9,6 +9,7 @@
"katex": "^0.12.0",
"katex-fonts": "katex/katex-fonts",
"markdown-it": ">=11.0",
"markdown-it-highlightjs": ">=3.4.0",
"markdown-it-katexx": ">=3.2.0",
"browserify": ">=16.5",
"tinyify": "browserify/tinyify"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment