remove # escaping to stop breaking html entities

This commit is contained in:
Cynthia Foxwell 2024-09-05 16:32:57 -06:00
parent 7bb0e32b9a
commit 105805fb69

View file

@ -32,7 +32,6 @@ function parseHtmlEntities(str) {
function htmlToMarkdown(str, images = true, embed = true) {
str = str.replaceAll("\\", "\\\\");
str = str.replaceAll("#", "\\#");
str = str.replace(/<style(\s+[^>]+)?>(.|\n)*?<\/style>/gi, "");
str = str.replace(/<a (\s+[^>]+)?href="([^"]+?)"(\s+[^>]+)?>(.+?)<\/a>/gi, (_, __, url, ___, text) => {
url = url.replace(/^\/\//, "https://").replace("\\#", "#");