mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-19 16:37:35 -07:00
18 lines
311 B
JavaScript
18 lines
311 B
JavaScript
|
/**
|
||
|
* 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()
|
||
|
};
|
||
|
}
|
||
|
};
|