[+] Parse commands
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user