fedimbed: parse more html to markdown
This commit is contained in:
parent
ab0f3756fe
commit
5a9a50a60f
1 changed files with 10 additions and 0 deletions
|
@ -461,6 +461,16 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
// TODO: convert certain HTML tags back to markdown
|
// TODO: convert certain HTML tags back to markdown
|
||||||
content = content.replace(/<\/?\s*br\s*\/?>/g, "\n");
|
content = content.replace(/<\/?\s*br\s*\/?>/g, "\n");
|
||||||
content = content.replace(/<\/p><p>/g, "\n\n");
|
content = content.replace(/<\/p><p>/g, "\n\n");
|
||||||
|
content = content.replace(/<li>/g, "- ");
|
||||||
|
content = content.replace(/<\/li>/g, "\n");
|
||||||
|
content = content.replace(
|
||||||
|
/<a .*?href="([^"]+?)".*?>([^<]+?)<\/a>/g,
|
||||||
|
"[$2]($1)"
|
||||||
|
);
|
||||||
|
content = content.replace(/<\/?code>/g, "`");
|
||||||
|
content = content.replace(/<\/?em>/g, "*");
|
||||||
|
content = content.replace(/<\/?u>/g, "__");
|
||||||
|
content = content.replace(/<\/?s>/g, "~~");
|
||||||
content = content.replace(/(<([^>]+)>)/gi, "");
|
content = content.replace(/(<([^>]+)>)/gi, "");
|
||||||
content = parseHtmlEntities(content);
|
content = parseHtmlEntities(content);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue