Skip to content

Repository-relative links open as https://<path> #760

Closed

Description

@alexgnq

Repository-relative links in a document, such as [review](docs/review.md), open as https://docs/review.md.

The dialect accepts these links (disguisedUrl only refuses relative paths that leave the repository), and the link editor offers "a path in this repository". But nothing resolves them against the document's repository:

  • Lexical 0.48's LinkNode.createDOM sets href from sanitizeUrl, which calls formatUrl. formatUrl prefixes https:// to anything that doesn't start with a scheme, /, . or #, so docs/review.md becomes https://docs/review.md.
  • follow in packages/editor/src/toolbar/link.tsx opens that href. A ./docs/review.md link would instead resolve against the Chopin page URL.

The Planner writes these links itself when it cites repository files, so most documents that reference code have broken links.

Expected: a repository-relative link opens https://github.com/{owner}/{repo}/blob/{default branch}/{path}, for example by overriding sanitizeUrl in a Chopin link node, or by resolving the path before it reaches Lexical.

Seen at e47b1a5. Changing the links through MCP update_document is also refused until the edited passages get new visuals, so the practical workaround is asking the Planner to use full GitHub URLs.

Activity

  1. alexgnq commented on Nov 2, 2026

    @alexgnq
    Author

    I'm glad to work on implementing this as well, if that helps.

  2. self-assigned this
    on Nov 5, 2026
  3. lavaman131 commented on Nov 5, 2026

    @lavaman131
    Collaborator

    Thanks for offering @alexgnq, and for tracking it down to formatUrl. I've got this one covered, and I'll link the PR here when it's up.

  4. lavaman131 commented on Nov 5, 2026

    @lavaman131
    Collaborator

    The fix is up in #788: a repository-relative link now opens the file on GitHub at the document's branch, in the editor, read-only views and Chat. A link that climbs out of the repository is refused.

  5. added 3 commits that reference this issue on Nov 5, 2026
    fdf4bea
    a1b4188
    059e0eb
  6. added a commit that references this issue on Nov 6, 2026
    7cb9d26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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