Skip to content

Fix rendered Markdown anchor links#10110

Open
CarlAmko wants to merge 1 commit intowarpdotdev:masterfrom
CarlAmko:carlamko/fix-markdown-anchor-links
Open

Fix rendered Markdown anchor links#10110
CarlAmko wants to merge 1 commit intowarpdotdev:masterfrom
CarlAmko:carlamko/fix-markdown-anchor-links

Conversation

@CarlAmko
Copy link
Copy Markdown

@CarlAmko CarlAmko commented May 5, 2026

Summary

  • resolve same-document Markdown anchors before generic notebook link resolution
  • derive anchor targets from rendered heading blocks and support normalized duplicate heading slugs
  • jump the rendered editor to the matching heading and keep missing anchors as broken local links

Issue

Fixes #10058

Test plan

  • cargo fmt --check
  • cargo test -p warp anchor

CHANGELOG-BUG-FIX: Fixed rendered Markdown table-of-contents anchors so same-document heading links jump to the target heading.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 5, 2026

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @CarlAmko on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 5, 2026
@CarlAmko
Copy link
Copy Markdown
Author

CarlAmko commented May 5, 2026

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 5, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 5, 2026

The cla-bot has been summoned, and re-checked this pull request!

@CarlAmko CarlAmko marked this pull request as ready for review May 5, 2026 14:32
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 5, 2026

@CarlAmko

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@CarlAmko
Copy link
Copy Markdown
Author

CarlAmko commented May 5, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 5, 2026

@CarlAmko

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds same-document rendered Markdown anchor handling for notebook links, including slug normalization, heading lookup, and local scrolling.

Concerns

  • Duplicate heading slug allocation can collide when a later heading's base slug is equal to an earlier generated duplicate suffix.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/notebooks/editor/model.rs Outdated
continue;
}

let count = slug_counts.entry(base_slug.clone()).or_insert(0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] Duplicate suffixes need to be allocated from the set of all generated slugs, not per base slug. With headings Goal, Goal 1, Goal, both the second and third headings generate goal-1, so #goal-2 cannot resolve.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds rendered Markdown same-document anchor handling before generic notebook link resolution, including heading slug generation, duplicate slug handling, and tests for local jump behavior.

Concerns

  • This changes user-visible rendered Markdown navigation behavior, but the PR description does not include screenshots or a video. For faster review, please upload screenshots or a video of the anchor link behavior working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@CarlAmko CarlAmko force-pushed the carlamko/fix-markdown-anchor-links branch from 2cb84a7 to d5994d2 Compare May 5, 2026 14:42
@CarlAmko
Copy link
Copy Markdown
Author

CarlAmko commented May 6, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 6, 2026

@CarlAmko

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR updates rendered Markdown link handling so same-document anchors are resolved locally before generic notebook link resolution, derives anchor targets from rendered heading blocks, and adds tests for slug normalization, duplicate heading slugs, and jump behavior.

Concerns

  • The PR changes user-visible rendered Markdown navigation behavior, but the description does not include screenshots or a video demonstrating anchor jumps and broken-anchor handling end to end. For faster review, please upload screenshots or a video of the feature working end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown ToC anchors don't do anything.

1 participant