Skip to content

sweep: a markdown link's #heading stays percent-encoded, so an embed of Note.md#My%20Heading shows the whole note #252

Closed

Description

@frostyard-machines

Kind: inconsistency. Severity: low.

Rule: docs/specs/render.md lines 65-68 and 73-75:

A markdown link whose destination has no scheme ... its data-href the destination percent-decoded, its target the part before #.

and an embed "with a heading subpath only its section".

Where (commit 83fb2a5): internal/render/links.go lines 92-98, markdownDestination: the destination is cut at #, only the part before it is decoded (url.PathUnescape(target)), and the rest is kept as it is (l.Subpath = "#" + sub).

  • internal/render/links.go line 311, noteSection, compares the subpath with the heading text (strings.EqualFold(h.Text, ...)).
  • So ![x](Other.md#My%20Heading) keeps #My%20Heading, finds no heading My Heading, and embeds the whole note. The link's data-href keeps %20 too.

Why it matters: Obsidian writes markdown-format links to a heading with %20 for each space. Such an embed shows the whole note, not the section, and the spec says the destination is decoded.

Suggested fix: Percent-decode the subpath as well as the target (after the cut at the first #), with a test for a heading that has a space.

Activity

  1. added
    sweep
    on Nov 19, 2026
  2. added a commit that references this issue on Nov 22, 2026
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

    sweep

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions