インラインのコードでもシンタックスハイライトを有効化

This commit is contained in:
syuilo 2017-02-12 02:38:47 +09:00
parent 7791dd5471
commit e19899962e
5 changed files with 382 additions and 378 deletions

View file

@ -2,6 +2,8 @@
* Code (inline)
*/
const genHtml = require('../core/syntax-highlighter');
module.exports = text => {
const match = text.match(/^`(.+?)`/);
if (!match) return null;
@ -9,6 +11,7 @@ module.exports = text => {
return {
type: 'inline-code',
content: code,
code: code.substr(1, code.length - 2).trim()
code: code.substr(1, code.length - 2).trim(),
html: genHtml(code.substr(1, code.length - 2).trim())
};
};