From 5d2523e6980e238c21eadf7ed260a135e575d0c9 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 25 Dec 2021 00:00:04 -0500 Subject: [PATCH] [+] Parse commands --- src/scripts/extended_markdown.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/scripts/extended_markdown.ts b/src/scripts/extended_markdown.ts index 29e4825..2ab39d7 100644 --- a/src/scripts/extended_markdown.ts +++ b/src/scripts/extended_markdown.ts @@ -2,7 +2,7 @@ * Regex used in markdown extension parsing */ const re = { - command: //g, + command: /)/g, hashes: /^#+/g, } @@ -17,5 +17,19 @@ function parseExtensions(raw: string): string const lines = raw.replace('\r\n', '\n').split('\n') let i = 0 + // Run all commands in markdown + while (i < lines.length) + { + // Find commands + const r = re.command.exec(lines[i]) + if (!r) continue + const cmd = r[0].substring(5).trim() + + // Run cmd + eval(cmd) + + i++; + } + return raw }