Make imports and identifiers clickable in code blocks - #91
Merged
randomdevpete merged 2 commits intoAug 19, 2026
Merged
Conversation
randomdevpete
commented
Aug 18, 2026
| // Regenerates the source-file list `lib/localSource.ts` resolves imports against. Runs at | ||
| // build start and again whenever a file is added or removed under src/, mirroring | ||
| // apiReferencePlugin.mjs's own regenerate-on-change shape. | ||
| import path from "node:path"; |
Owner
Author
There was a problem hiding this comment.
Could this and sourceLinks.mjs be reimplemented in typescript?
…their API reference Highlighted code (demo source, guide/README fences, the API reference itself) now links any recognised export name to its API reference anchor, reusing the same #slug scheme heading anchors already use. slug.ts pulls the shared slugify out of Markdown.tsx so apiLinks.ts can derive the manifest straight from the generated reference's own headings, never drifting from the anchors actually rendered. Ticket: 684
randomdevpete
force-pushed
the
task-684-clickable-imports-and-jarl-references-in-code
branch
2 times, most recently
from
August 19, 2026 00:51
3b92725 to
0b77005
Compare
CodeBlock now accepts the repo path of the file it's showing (DemoPage already knew its own demo's), and links a relative import specifier straight to that file on GitHub. The target file list is generated at build/dev time (sourceLinksPlugin.ts, mirroring apiReferencePlugin.mjs's own shape) so resolution never depends on Vite's module graph at render time. Ticket: 684
randomdevpete
force-pushed
the
task-684-clickable-imports-and-jarl-references-in-code
branch
from
August 19, 2026 00:53
0b77005 to
e5418bb
Compare
randomdevpete
deleted the
task-684-clickable-imports-and-jarl-references-in-code
branch
August 19, 2026 11:55
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.
Summary
Make imports and identifiers clickable in demo source code, guides, and API reference pages:
jarl-atoms/jarl-reactidentifier links to its API reference entryslugifyfunction that renders heading anchors, so it cannot driftHow it works
Two new source files track clickable targets:
api-linksmap: scanned from the API reference's own### \Name`` headings (inherits anchors automatically)source-fileslist: walkspackages/docs/src/to resolve relative imports to GitHub blob URLsThe
linkifyHtmlfunction post-processes highlighted code to wrap identifiers/imports in anchors, tracking whichhljs-*class is open to avoid linking inside comments.Style guide compliance
No style guide exceptions. Comments are appropriately scoped, docblocks on public exports only, DRY applied (slugify extracted into shared module), no dead code or unused imports.