-
Notifications
You must be signed in to change notification settings - Fork 2
Remove links pasting #15
Comments
Because smart join operates in pure text mode. And it is (almost) intended for pasting from PDF.
Yes, a custom transform could do it. From the picture you provided, It seems that there are spaces and newlines inside markdown links. I checked it and it looks like a bug in turndown. So if you want to write a custom transform to do the task, note that remark will produce a bad syntax tree because of it. Of course you can also use regex instead of remark to avoid it. |
The following script might helps. It uses a simple regex. export async function stripWhiteSpacesInLinks(input, { turndown }) {
if (input.types.includes("text/html")) {
const html = await input.getType("text/html");
const md = turndown.turndown(await html.text());
return md.replace(/\[\n*(.*)\n*\]\((.*)\)/gm, "[$1]($2)");
}
return { kind: "err", value: "No html found in clipboard!" };
}
stripWhiteSpacesInLinks.type = "blob"; |
The script works for me. It seems I can't expect this bug to be fixed on turndown's side: mixmark-io/turndown#419 When I get more time I will fix it in the default paste command, maybe by maintaining a fork of turndown. |
You are right, using perplexity from the official website and then pasting it with your script does work, really great. |
Hi,





I use perplexity and it makes citations that when i normally copy and paste them on obsidian they breake and make a lot of blanks lines,
Smart join is incredible but it delete all the links and tabulations.
Is there a way to fix it also with an custom trasform it would be really usefull
It does this only with that site and can't understand why...
The text was updated successfully, but these errors were encountered: