Skip to content

[bug] During making of external links #471

Closed

Description

@SandeepKumarKuanar

Bug: Markdown link input causes temporary text invisibility

Problem: When creating a link using [text](url), the link text becomes invisible after typing ( and pasting the URL. It only reappears after the closing ) is typed.

Steps to reproduce:

  1. Type [Example](
  2. Paste or type a URL
  3. Notice that Example disappears
  4. Type ) — Example reappears

Expected behavior: Text should remain visible during input, with link styling applied only after the syntax is complete.

Cause: The Markdown renderer likely treats incomplete links as invalid and hides them until the syntax is fully closed.

Suggested fix: Render link text as plain text during input, and only apply link styling when the URL is complete.

Activity

  1. adibhanna commented on Jul 24, 2026

    @adibhanna
    Contributor

    Fixed in a4c8b9a (shipping in 2.18.0). Thanks for the clear repro steps, they pointed straight at it.

    Your diagnosis was right, and there turned out to be two separate causes behind the one symptom:

    1. The brackets collapsed too early. While the target is unclosed, the Markdown parser ends the Link node at the ], so [Example]( parses as Link[0,9] with the ( as ordinary text. Live preview hides the [ and ] whenever the cursor is not inside the Link range, and a cursor sitting in the half-typed target is outside it. So the line rendered as Example(.

    2. The pasted URL vanished outright. A URL typed or pasted after that ( parses as an autolink hanging off the paragraph, not as the link destination. The rule for hiding a destination URL was "it follows a (", which that autolink also satisfies, so the URL got hidden too. That is the disappearing text you saw: [Example](https://example.com rendered as just Example(.

    The fix, close to what you suggested: a [label]( with no matching ) yet is not treated as a link at all, so it stays as plain source while you type or paste, and only collapses once the syntax is complete. Hiding a destination URL now also requires it to actually be part of the link node. Parens are counted rather than stopping at the first ), so a destination like https://en.wikipedia.org/wiki/Foo_(bar is still recognised as unterminated.

    Same change fixed a related case nobody had filed: a bare URL in parentheses, a (https://parens.example) b, used to render as a () b.

    Completed links behave exactly as before: [label](url) still collapses to just the label once the cursor leaves the line.

    Verified in the running desktop app at default settings, plus 6 new regression tests.

    One note that may explain why not everyone hits this: auto-pairs (on by default) turns ( into () as you type, which parses as a complete link right away and hides the bug. It shows up with auto-pairs off, or when editing an existing link where the ) is briefly missing.

  2. SandeepKumarKuanar commented on Jul 25, 2026

    @SandeepKumarKuanar
    Author

    thank you so much for listening to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions