convert <BR> in code blocks to newline
parent
31005e81f1
commit
0423569436
3
index.js
3
index.js
|
@ -173,8 +173,9 @@ function code_block_to_markdown (html) {
|
||||||
const match_code = /^\s*<code[^>]*>[\r\n]*([\s\S]*)<\/code>\s*$/ig.exec(inner_html);
|
const match_code = /^\s*<code[^>]*>[\r\n]*([\s\S]*)<\/code>\s*$/ig.exec(inner_html);
|
||||||
if (match_code && match_code[1])
|
if (match_code && match_code[1])
|
||||||
inner_html = 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.replace(/(<([^>]+)>)/ig, "");
|
||||||
inner_html = htmlentities.decode(inner_html);
|
inner_html = htmlentities.decode(inner_html);
|
||||||
const markdown = "```\n"+inner_html+"\n```\n";
|
const markdown = "```\n"+inner_html+"\n```\n";
|
||||||
return markdown;
|
return markdown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue