Improve editor, plugin updates, and window transfers for 0.1.41

This commit is contained in:
Knotty Wyvern
2026-10-21 10:42:44 -07:00
parent 68e86ab6eb
commit 42dd0fa711
56 changed files with 2313 additions and 221 deletions
+4 -3
View File
@@ -18,7 +18,8 @@ function parseAttrs(raw: string): Record<string, string> {
}
export function htmlToMarkdown(html: string): string {
const tokens = html.match(/<\/?[a-zA-Z][^>]*>|[^<]+/g) ?? [];
// Windows HTML clipboard fragments include comments around the copied content.
const tokens = html.replace(/<!--[\s\S]*?(?:-->|$)/g, "").match(/<\/?[a-zA-Z][^>]*>|[^<]+/g) ?? [];
const out: string[] = [];
const list: string[] = [];
let inPre = false;
@@ -39,7 +40,7 @@ export function htmlToMarkdown(html: string): string {
const spanKind: string[] = [];
function flushInline(): string {
const text = unescapeHtml(inline.replace(/\s+/g, " ").trim());
const text = unescapeHtml(inline.replace(/\s+/g, " ").replace(/\s*<br>\s*/g, "<br>").trim());
inline = "";
return text;
}
@@ -185,7 +186,7 @@ export function htmlToMarkdown(html: string): string {
const tag = (space === -1 ? body : body.slice(0, space)).toLowerCase();
const attrs = space === -1 ? {} : parseAttrs(body.slice(space + 1));
if (tag === "br") {
inline += "\n";
inline += inCell ? "<br>" : "\n";
continue;
}
if (tag === "img") {