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

Paste a URL to automatically create a Markdown link #390

Open
4 tasks done
karlhorky opened this issue Feb 1, 2024 · 3 comments
Open
4 tasks done

Paste a URL to automatically create a Markdown link #390

karlhorky opened this issue Feb 1, 2024 · 3 comments
Labels
🗄 area/interface This affects the public interface 🌊 blocked/upstream This cannot progress before something external happens first 🤞 phase/open Post is being triaged manually 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have

Comments

@karlhorky
Copy link

karlhorky commented Feb 1, 2024

Initial checklist

Problem

Pasting a URL overwrites the text

Solution

Pasting a URL in MDX should behave the same way as it does in Markdown in VS Code 1.86 (January 2024):

Want to turn that link you copied into a Markdown link? When you paste a URL into a Markdown file with text selected, VS Code now automatically inserts a Markdown link:

This feature is controlled by the markdown.editor.pasteUrlAsFormattedLink.enabled setting. You can change it to customize this behavior:

  • smartWithSelection — The default. This enables the feature when you have selected text and are not inside a special element, such as a code block.
  • smart — Same as smartWithSelection but does not require a selection.
  • always — Always paste urls as a Markdown links
  • never — Disable pasting as Markdown links.

After you've pasted a value, you can always switch to paste the content in a different way by using the Paste control.

Alternatives

A simple implementation:

  1. just link the selected text with the URL being pasted from the clipboard
  2. boolean flag to disable the feature
@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Feb 1, 2024
@remcohaszing remcohaszing added 🦋 type/enhancement This is great to have 🗄 area/interface This affects the public interface 🧒 semver/minor This is backwards-compatible change 👍 phase/yes Post is accepted and can be worked on labels Feb 1, 2024
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Feb 1, 2024

This comment has been minimized.

@remcohaszing
Copy link
Member

Yep, great idea!

@remcohaszing
Copy link
Member

This uses a proposed API. Specifically, it uses the documentPaste API. If I understand correctly, third party extensions using proposed APIs can’t be published.

@remcohaszing remcohaszing added 🌊 blocked/upstream This cannot progress before something external happens first 🤞 phase/open Post is being triaged manually labels Feb 2, 2024
@github-actions github-actions bot removed the 👍 phase/yes Post is accepted and can be worked on label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 🌊 blocked/upstream This cannot progress before something external happens first 🤞 phase/open Post is being triaged manually 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

No branches or pull requests

2 participants