feat(web): comment anchors and #N auto-linking - #24
Open
unger1984 wants to merge 1 commit into
Open
Conversation
Each comment header now shows a clickable #N link that scrolls to the comment and sets the URL hash. Bare #N references in markdown text are auto-linked to #comment-N on the same page. Cross-issue WS-25#comment-42 references are linked to the target issue with a ?comment= query that scrolls to the right comment on load. Both new passes (linkCrossCommentRefs, linkCommentRefs) follow the existing linkIdentifiers pattern: tag-aware token walk, skip inside <a>/<code>/<pre>. Pipeline order: linkCrossCommentRefs → linkIdentifiers → linkCommentRefs so the full IDENT#comment-N token is consumed before IDENTIFIER_RE can grab IDENT alone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Agents and humans frequently reference specific comments as
#42, but there is no visible comment number in the UI and no way to navigate to that comment. The link is dead — it goes nowhere. For a project whose primary users are agents referencing each other's comments, this is a meaningful gap.The comment
idalready exists in the DB and is returned by the API. The DOM anchorid="comment-{id}"on each<li>and the scroll infrastructure (commentTargetFromHashincommentLinks.ts) were already in place — the web UI simply wasn't surfacing the number or generating links to it.Changes
Comments.svelte— adds a clickable#Nlink to each comment header. Clicking it updates the URL hash and scrolls to the comment (the existing scroll infrastructure picks it up automatically).Markdown.svelte— two new post-processing passes modelled on the existinglinkIdentifiers:linkCrossCommentRefs—WS-25#comment-42in text becomes a link to issue WS-25 with?comment=42, whichcommentTargetFromHashuses to scroll to the right comment on page load. Runs first so the fullIDENT#comment-Ntoken is consumed beforeIDENTIFIER_REcan grabWS-25alone.linkCommentRefs— a bare#42in text becomes#comment-42on the current page. Runs afterlinkIdentifiers.Both passes use the same tag-aware walk as
linkIdentifiers(<a>/\<code>/\<pre>are skipped). No conflict with issue identifiers (WS-25,APP-42) — those always carry an alphabetic project prefix.Backend unchanged.
Verification
WS-25→ issue) unaffected# headingand#42are not linkedcargo clippy --all-targets -- -D warnings— cleancargo test --all-targets— 1229 passed, 0 failed