github/paste-markdown

Pasting HTML with links can place link in the wrong place

Closed this issue · 1 comments

jclem commented

When pasting HTML such as this:

example example

...the link will end up at the wrong place in the pasted Markdown. This appears to be because we search the text/plain clipboard content for the first occurrence of the linked string. This is a reasonable heuristic, but ends up with edge cases like the one above.

I'm not sure what the right solution here is, but since we have a document returned by a DOMParser, anyway, perhaps we could instead generate Markdown by using NodeIterator or TreeWalker?

I missed this one coming through @jclem – thanks, you're right. We'll take a look.