simplified regexp parsing code blocks

main
macsplit 2022-05-13 11:23:40 +01:00
parent 0423569436
commit 74a379e279
1 changed files with 2 additions and 2 deletions

View File

@ -173,8 +173,8 @@ function code_block_to_markdown (html) {
const match_code = /^\s*<code[^>]*>[\r\n]*([\s\S]*)<\/code>\s*$/ig.exec(inner_html);
if (match_code && match_code[1])
inner_html = match_code[1];
inner_html = inner_html.replace(/<br[^>]*>/ig,"\n");
inner_html = inner_html.replace(/(<([^>]+)>)/ig, "");
inner_html = inner_html.replaceAll(/<br[^>]*>/ig,"\n");
inner_html = inner_html.replaceAll(/<[^>]+>/ig, "");
inner_html = htmlentities.decode(inner_html);
const markdown = "```\n"+inner_html+"\n```\n";
return markdown;