summaryrefslogtreecommitdiff
path: root/src/text/parse/elements/code.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/text/parse/elements/code.ts')
-rw-r--r--src/text/parse/elements/code.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/text/parse/elements/code.ts b/src/text/parse/elements/code.ts
index 4821e95fe2..de87aa410b 100644
--- a/src/text/parse/elements/code.ts
+++ b/src/text/parse/elements/code.ts
@@ -4,7 +4,14 @@
import genHtml from '../core/syntax-highlighter';
-module.exports = text => {
+export type TextElementCode = {
+ type: "code"
+ content: string
+ code: string
+ html: string
+};
+
+export default function(text: string) {
const match = text.match(/^```([\s\S]+?)```/);
if (!match) return null;
const code = match[0];
@@ -13,5 +20,5 @@ module.exports = text => {
content: code,
code: code.substr(3, code.length - 6).trim(),
html: genHtml(code.substr(3, code.length - 6).trim())
- };
-};
+ } as TextElementCode;
+}