1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

Add code theme selector

This commit is contained in:
dojineko
2016-04-17 21:00:34 +09:00
parent 43fb37ab1d
commit 777f7f9305
13 changed files with 110 additions and 16 deletions

View File

@@ -11,10 +11,14 @@ var md = markdownit({
highlight: function (str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(lang, str).value
return '<pre class="hljs"><code>' +
hljs.highlight(lang, str).value +
'</code></pre>';
} catch (e) {}
}
return str.replace(/\&/g, '&amp;').replace(/\</g, '&lt;').replace(/\>/g, '&gt;').replace(/\"/g, '&quot;')
return '<pre class="hljs"><code>' +
str.replace(/\&/g, '&amp;').replace(/\</g, '&lt;').replace(/\>/g, '&gt;').replace(/\"/g, '&quot;') +
'</code></pre>';
}
})
md.use(emoji, {