Skip to content
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

Test Markdown link updates on paste #210945

Closed
3 tasks done
mjbvz opened this issue Apr 22, 2024 · 1 comment
Closed
3 tasks done

Test Markdown link updates on paste #210945

mjbvz opened this issue Apr 22, 2024 · 1 comment

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 22, 2024

Test for #209318

Complexity: 3

Create Issue


Summary

The new markdown.experimental.updateLinksOnPaste setting allows VS Code to automatically update any relative links in text that is copy and pasted between markdown files in the current window. For example, if you copy this text from ./readme.md:

![alt](img.png)

If you paste it into ./sub/other.md, the text will automatically be rewritten to:

![alt](../img.png)

This feature works for:

Relative links and images:

[text](file.md)
[text](/file.md)
[text](../file.md)
[text](file)  No extension used but resolves to `file.md`

---

Links in `src` html elements:

<video src="file.mp4"></video>
<a href="file.md">...</a>

---

Fragment links:

[text](#header-in-current-file)
[text](other.#header-in-other-file)


---

Reference links:

[Some text][def] <-- Copy this and the definition below should get added to the new file on paste

[def]: http://example..com

Testing

  • Set "markdown.experimental.updateLinksOnPaste": true

  • Try copying text that includes some of the link formats above

  • Make sure the links are correctly updated on paste

  • Try testing other variations or combinations

  • Make sure you can use the paste widget to switch back to a normal paste if you want instead

Known limitations

  • This only works for when copy and pasting within editors in the same window. It does not work across VS Code windows or from another app into VS Code

  • We currently support multicursor paste but not multi-cursor copy. This means the first cursor's content is always used on paste

@mjbvz mjbvz added this to the April 2024 milestone Apr 22, 2024
@benibenj benibenj removed their assignment Apr 23, 2024
@daviddossett daviddossett removed their assignment Apr 23, 2024
@daviddossett
Copy link
Contributor

Works great 👍

@connor4312 connor4312 removed their assignment Apr 23, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants