mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-03-04 07:18:50 -07:00
17 lines
355 B
TypeScript
17 lines
355 B
TypeScript
/**
|
|
* Code (block)
|
|
*/
|
|
|
|
import genHtml from '../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())
|
|
};
|
|
};
|