Add extract_link_definitions() for reference-style links#164
Merged
Conversation
Foundation for markdown reference-style link support. Adds function to parse link definitions in the format "[label]: url" from markdown text. Not yet integrated into business logic. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Feb 11, 2026
nesono
added a commit
that referenced
this pull request
Feb 11, 2026
### Summary Activate reference-style link support by integrating `resolve_reference_links()` into the cross-reference extraction flow. Reference-style links in requirement bodies are now automatically converted to inline links during validation. ### Implementation Summary Modified `extract_markdown_references()` in `fire/starlark/validate_cross_references.py` to: - Call `markdown_common.resolve_reference_links()` before extracting references - Wrap in try/except to handle undefined references gracefully - Continue with original text if undefined references are found (they won't match patterns anyway) This is a minimal integration point that activates all the infrastructure built in PRs #164, #165, and #166. **Example:** Requirements can now write: ```markdown See [REQ-VEL-001][1] for velocity limits and [@braking_distance_table][2]. [1]: /examples/requirements/velocity_requirements.sysreq.md?version=2#REQ-VEL-001 [2]: /examples/vehicle_params.yaml?version=1#braking_distance_table ``` And it will be validated as if it were written with inline links. ### Testing Verified integration works: - ✓ `bazel test //fire/starlark:extract_source_traceability_test` passes - ✓ `bazel build //examples/brake_control:brake_controller_requirements` succeeds - ✓ All existing requirement validation still works - ✓ No breaking changes to existing inline link syntax 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
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
Add
extract_link_definitions()function to parse reference-style link definitions from markdown text. This is the foundation for upcoming reference-style link support (https://www.markdownguide.org/basic-syntax/#reference-style-links).Implementation Summary
Added new function
extract_link_definitions(text: str) -> dict[str, str]tofire/starlark/markdown_common.pythat:[label]: urlThe function is not yet integrated into business logic - it's pure infrastructure that will be activated in a future PR when we add link resolution.
Testing
Added comprehensive test class
TestExtractLinkDefinitionswith 11 test cases:All tests pass:
bazel test //fire/starlark:markdown_common_test✓🤖 Generated with Claude Code