fedimbed: less smart anchor tag regex since nested tags wont break anything
This commit is contained in:
parent
79cf9b9be7
commit
92d70621ab
1 changed files with 2 additions and 5 deletions
|
@ -512,16 +512,13 @@ async function processUrl(msg, url, spoiler = false) {
|
||||||
content = content ?? "";
|
content = content ?? "";
|
||||||
cw = cw ?? "";
|
cw = cw ?? "";
|
||||||
|
|
||||||
// TODO: convert certain HTML tags back to markdown
|
// FIXME: stop being lazy and use an html parser
|
||||||
|
content = content.replace(/<a .*?href="([^"]+?)".*?>(.+?)<\/a>/g, "[$2]($1)");
|
||||||
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(/<ol>/g, "\n");
|
content = content.replace(/<ol>/g, "\n");
|
||||||
content = content.replace(/<li>/g, "- ");
|
content = content.replace(/<li>/g, "- ");
|
||||||
content = content.replace(/<\/li>/g, "\n");
|
content = content.replace(/<\/li>/g, "\n");
|
||||||
content = content.replace(
|
|
||||||
/<a .*?href="([^"]+?)".*?>([^<]+?)<\/a>/g,
|
|
||||||
"[$2]($1)"
|
|
||||||
);
|
|
||||||
content = content.replace(/<\/?code>/g, "`");
|
content = content.replace(/<\/?code>/g, "`");
|
||||||
content = content.replace(/<\/?em>/g, "*");
|
content = content.replace(/<\/?em>/g, "*");
|
||||||
content = content.replace(/<\/?u>/g, "__");
|
content = content.replace(/<\/?u>/g, "__");
|
||||||
|
|
Loading…
Reference in a new issue