Skip to content

Parse and preserve optional Markdown link titles without corrupting destinations #85

Open

Description

@BinaryOutlook

A valid Markdown link with an optional title produces a malformed destination, and editing its paragraph drops the title from outgoing Markdown. Treat the destination and title as separate values and preserve their semantics.

Priority: P2 / Medium — navigation and source correctness. Reproduced on #80 and baseline 41ea238a99aea72b197fa33dc1001bd9ef09a0e5.

Reproduction and findings

[Title](https://example.test/ "description") tail
  1. Open the synthetic source in visual mode and inspect the rendered anchor.
  2. Append ! to tail without editing the link.
  3. Capture the outgoing Markdown and reopen it.

Observed: the anchor href is https://example.test/ with a trailing space; the title text becomes malformed attribute content. The outgoing save is [Title](https://example.test/ ) tail!, losing description.

Expected: href is https://example.test/, the optional title is description, and an edit outside the link preserves both.

Scope and acceptance criteria

  • Parse and safely encode supported optional link-title syntax independently from its destination.
  • Preserve title and target semantics through editing, serialization, undo and save/reopen.
  • Cover quoted titles, escaped punctuation, empty/absent titles, links inside supported inline containers, and a native save regression.
  • Retain safe URL handling and avoid introducing attribute injection while fixing parsing.

Coordinate fixtures with #77, which tracks balanced destination parentheses. This issue is specifically title parsing/preservation; do not require a full inline-parser replacement to close it.

Source evidence

The inline link match and destination interpolation does not separate the optional title from the destination. Trace the matching inline serialization path when retaining the title.

Build identity and verification boundary

Recorded during the 2026-09-27 audit of #80 at ffbdad524d393aa783760f4829cb995d8b9d6405 (package version 0.4.0), using Node 24.21.0 on macOS ARM64. The tested product source was unmodified. This is an unreleased development snapshot.

Reproduced in Chrome 154.0.8037.57 through the production editor fixture, real keyboard edits, captured host save messages, and simulated reopening. This establishes rendered/outgoing-Markdown behavior; this exact case was not verified through an installed VS Code filesystem save or export readers.

Reproduce and validate changes using the checkout's build guide and testing guide. Keep evidence synthetic and sanitized.

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions