Skip to content

Markdown conceal: named links still paint as label (url) when OSC 8 is available #1435

Closed as duplicate

Description

@tkossak

Summary

When conceal is on, named markdown links always paint as:

label (https://example.com/path)

even if the terminal already has OSC 8 hyperlinks. The url field on those chunks is set correctly, so the whole span is clickable — the href is just still visible.

Expected when OSC 8 / hyperlinks capability is on: visible text is only label, with { url: href } on the label chunks.

Expected when OSC 8 is off: keep today’s label (url) so the target is still readable.

Not the same as

Where

packages/core/src/renderables/Markdown.ts, case "link" in renderInlineToken:

case "link": {
  const linkHref = { url: token.href }
  if (this._conceal) {
    for (const child of token.tokens) {
      this.renderInlineTokenWithStyle(child as MarkedToken, chunks, "markup.link.label", linkHref)
    }
    chunks.push(this.createChunk(" (", "markup.link", linkHref))
    chunks.push(this.createChunk(token.href, "markup.link.url", linkHref))
    chunks.push(this.createChunk(")", "markup.link", linkHref))
  }
  // ...
}

createChunk already attaches OSC 8 via the link field. Conceal still appends " (" + href + ")" unconditionally.

Contrast: case "image" in the same function already omits the href when conceal is on (label-only + { url }).

Suggested fix

When conceal is on and hyperlinks are enabled (setHyperlinksCapability / OSC 8), emit only the label tokens with { url: token.href }. Skip the " (", href, ")" chunks.

When hyperlinks are off, keep the expanded label (url) fallback.

Optional extra (orthogonal, #1050): if link text === href, never append the suffix.

Why it matters

Consumers (OpenCode TUI) tell agents to write [short-label](long-url) so tables/lists stay narrow. Painting the full URL next to the label undoes that. Agents cannot emit raw OSC 8 (pipeline strips/mangles it); markdown → conceal paint is the only path.

Consumer

anomalyco/opencode#45001 (Warp, OpenCode 1.18.23: OSC 8 works, href still visible).

Activity

  1. simonklee commented on Aug 25, 2026

    @simonklee
    Member

    Thanks, this is valid, but we have a quite a few of these open now so i'm closing #1380, #1196, #869, and #864. When looking at hyperlinks we'll keep this issue in mind.

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