Improve editor, plugin updates, and window transfers for 0.1.41
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user