nanka iroiro

This commit is contained in:
syuilo
2017-02-09 01:07:06 +09:00
parent 5ad6877090
commit a68efc1e5e
4 changed files with 52 additions and 20 deletions

View File

@@ -0,0 +1,17 @@
/**
* Code
*/
const regexp = /```([\s\S]+?)```/;
module.exports = {
test: x => new RegExp('^' + regexp.source).test(x),
parse: text => {
const code = text.match(new RegExp('^' + regexp.source))[0];
return {
type: 'code',
content: code,
code: code.substr(3, code.length - 6).trim()
};
}
};