インラインのコードでもシンタックスハイライトを有効化
This commit is contained in:
parent
7791dd5471
commit
e19899962e
5 changed files with 382 additions and 378 deletions
|
|
@ -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())
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue