Skip to content

Balanced parentheses are truncated in visual link and image destinations #77

Open

Description

@BinaryOutlook

Problem

Balanced parentheses inside inline link and image destinations are cut off at the first ). The visual editor shows a broken target and leaves the rest of the destination as visible text. An unrelated edit happened to reconstruct the original Markdown bytes in this probe, but the rendered link and image elements have truncated target attributes.

Reproduction

Try these synthetic lines separately in the visual editor:

[target](https://example.invalid/a(b))
![photo](images/photo(1).png)

Observed: the link href is https://example.invalid/a(b with a trailing ) outside the link. The image src is images/photo(1, with .png) outside the image. The immediate round trip and an unrelated tail edit/save retained the original source spelling; that does not make the rendered destinations usable.

Expected: each balanced pair is part of the destination. CommonMark permits balanced parentheses in unbracketed link destinations: https://spec.commonmark.org/0.31.2/#link-destination.

Evidence and scope

Reproduced in the freshly generated standalone Chromium editor from clean main commit 41ea238a99aea72b197fa33dc1001bd9ef09a0e5 (package version 0.4.0) on macOS arm64. The browser probe captured DOM attributes, immediate round trip, and outgoing host edit/save payload. It did not exercise actual link clicks, image file loading, installed VS Code, or exports.

The inline destination matches in src/webview/editor.js and the host image-path conversion in src/editorProvider.ts use first-) matching. Suggested coverage: balanced and nested parentheses, escaped parentheses, images with local filenames, target/tooltips, unrelated save/reopen, and export.

Activity

  1. added
    bug
    on Sep 25, 2026
  2. BinaryOutlook commented on Sep 27, 2026

    @BinaryOutlook
    OwnerAuthor

    PR #80 audit update: balanced link destinations remain truncated

    Remaining P2 behavior: retaining the original Markdown bytes does not repair the rendered navigation target on ffbdad524d393aa783760f4829cb995d8b9d6405.

    [Wiki](https://example.test/Foo_(bar)) tail

    Open visually, inspect the anchor, then append ! to tail. Observed: href is https://example.test/Foo_(bar, with the closing ) outside the anchor. The outgoing save remains [Wiki](https://example.test/Foo_(bar)) tail!, preserving the source spelling while the rendered target stays wrong.

    Evidence: 2026-09-27, unmodified #80 production fixture, Node 24.21.0 / Chrome 154.0.8037.57 on macOS ARM64; DOM attributes, keyboard edits, save payload and simulated reopening. This new observation is the link case only: it does not newly verify image loading, actual navigation, installed VS Code or export. The relevant destination match remains in parseInline. Preserve both rendered-target and round-trip assertions when resolving this issue.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions