fedimbed: fix blockquotes

This commit is contained in:
Cynthia Foxwell 2024-01-07 14:03:50 -07:00
parent 022202bd1c
commit e14cf5f9d9

View file

@ -633,10 +633,14 @@ async function processUrl(msg, url, spoiler = false) {
// FIXME: stop being lazy and use an html parser // FIXME: stop being lazy and use an html parser
content = content.replace(/<a .*?href="([^"]+?)".*?>(.+?)<\/a>/g, "[$2]($1)"); content = content.replace(/<a .*?href="([^"]+?)".*?>(.+?)<\/a>/g, "[$2]($1)");
content = content.replace( content = content.replace(
/<img .*?src="([^"]+?)".*?alt="([^"]+?)".*?\/>/g, /<img .*?src="([^"]+?)".*?(alt|title)="([^"]+?)".*?\/>/g,
"[$2]($1)" "[$3]($1)"
); );
content = content.replace(/<\/?\s*br\s*\/?>/g, "\n"); content = content.replace(/<\/?\s*br\s*\/?>/g, "\n");
content = content.replace(
/<blockquote.*?>(.*?)<\/blockquote>/,
(_, c) => "> " + c.split("\n").join("\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, "- ");