Skip to content

Paste a URL to automatically create a Markdown link #390

Open
@karlhorky

Description

@karlhorky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions