blob: 99fe6a183c269f00866d416737b411d2b52aba26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/**
* Code (block)
*/
const genHtml = require('../core/syntax-highlighter');
module.exports = text => {
const match = text.match(/^```([\s\S]+?)```/);
if (!match) return null;
const code = match[0];
return {
type: 'code',
content: code,
code: code.substr(3, code.length - 6).trim(),
html: genHtml(code.substr(3, code.length - 6).trim())
};
};
|