Fix: resolve relative concept links in the graph viewer detail panel#181
Open
ryanb93 wants to merge 1 commit into
Open
Fix: resolve relative concept links in the graph viewer detail panel#181ryanb93 wants to merge 1 commit into
ryanb93 wants to merge 1 commit into
Conversation
The bundled graph viewer's detail panel only converted absolute markdown links (e.g. `/tables/users.md`) into in-app node selections. Relative links (`users.md`, `../references/metrics/dau.md`) — which the Python edge extractor `_extract_links` already resolves, and which the format's own examples use — fell through to the "external link" branch and opened the raw `.md` file instead of selecting the concept. Resolve link hrefs to concept ids relative to the current concept's directory (handling `.`, `..`, and `#anchor`), so clicking any intra-bundle link selects that node, matching the behaviour of the graph edges. viz.js is a browser-only static asset with no JS test harness in the repo; the relative-link contract is already covered on the Python side by test_viewer.py::test_cross_links_become_edges. Verified manually that absolute and relative links (including `..` traversal and `#anchors`) resolve to the correct concept id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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
In the bundled OKF graph viewer (
viz.html), clicking a concept link inside the detail panel opened the raw.mdfile instead of selecting that concept in the graph — but only for relative links.rewriteInternalLinksonly recognised absolute links (/tables/users.md). Relative links —users.md,../references/metrics/dau.md— fell through to the external-link branch. This is an asymmetry with the rest of the toolchain:_extract_links(generator.py) already resolves relative links, so the graph edges render correctly;So a bundle authored with relative links draws the right graph, but its in-panel links don't navigate.
Fix
Resolve each markdown-link href to a concept id relative to the current concept's directory — handling
.,.., and#anchor— then select the node if it exists (falling back to external-link behaviour otherwise). This brings the click handler to parity with the already-supported/edge-extracted relative links. Absolute links keep working unchanged.Testing
viz.jsis a browser-only static asset and the repo has no JS test harness, so no automated JS test is added (introducing one for a ~30-line fix seemed disproportionate — happy to add one if maintainers prefer). The relative-link contract is already covered on the Python side bytest_viewer.py::test_cross_links_become_edges, which uses relative links. Manually verified that absolute, sibling,..-traversing, and#anchorlinks all resolve to the correct concept id, and that unresolved links still render as external.🤖 Generated with Claude Code