From 042356943602fae7d4e75624dece3b3abe8e6139 Mon Sep 17 00:00:00 2001 From: macsplit Date: Fri, 13 May 2022 11:02:25 +0100 Subject: [PATCH] convert
in code blocks to newline --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 09a781c..15e069d 100755 --- a/index.js +++ b/index.js @@ -173,8 +173,9 @@ function code_block_to_markdown (html) { const match_code = /^\s*]*>[\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(/]*>/ig,"\n"); inner_html = inner_html.replace(/(<([^>]+)>)/ig, ""); - inner_html = htmlentities.decode(inner_html); + inner_html = htmlentities.decode(inner_html); const markdown = "```\n"+inner_html+"\n```\n"; return markdown; }