Skip to content

Pasting HTML with links can place link in the wrong place #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jclem opened this issue Mar 7, 2022 · 1 comment · Fixed by #50
Closed

Pasting HTML with links can place link in the wrong place #45

jclem opened this issue Mar 7, 2022 · 1 comment · Fixed by #50
Labels
bug Something isn't working

Comments

@jclem
Copy link

jclem commented Mar 7, 2022

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?

@jclem jclem added the bug Something isn't working label Mar 7, 2022
@imjohnbo
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants