Skip to content

Rewrite operationId cross-references for path-style anchors#21

Merged
edavidaja merged 3 commits intomainfrom
rewrite-operationid-crossrefs
Apr 13, 2026
Merged

Rewrite operationId cross-references for path-style anchors#21
edavidaja merged 3 commits intomainfrom
rewrite-operationid-crossrefs

Conversation

@edavidaja
Copy link
Copy Markdown
Collaborator

Summary

When anchor-style: path is configured, endpoint descriptions and schema property docs may still contain fragment links using operationId style (e.g. (#getTask)). These become broken since the rendered headings use path-style anchors (e.g. #get-/v1/tasks/-id-).

This adds a post-processing pass that rewrites all operationId fragment references in the generated markdown to their path-style equivalents:

  • buildOperationIdToPathMap() creates the reverse lookup from operationId to path-style anchor
  • rewriteOperationIdRefs() rewrites (#operationId) patterns in markdown text
  • Applied as a single pass over the full output (catches references in schema property descriptions, not just top-level endpoint descriptions)

Test plan

  • New unit tests for buildOperationIdToPathMap and rewriteOperationIdRefs
  • Full test suite passes (56 tests)
  • Verified against Posit Connect API docs: lychee link checker reports 0 API fragment errors with anchor-style: path

E. David Aja and others added 3 commits April 13, 2026 17:43
When `anchor-style: path` is configured, endpoint descriptions and
schema docs may still contain fragment links using operationId style
(e.g. `(#getTask)`). These become broken since the rendered headings
use path-style anchors (e.g. `#get-/v1/tasks/-id-`).

This adds a post-processing pass that rewrites all operationId fragment
references in the generated markdown to their path-style equivalents.

- `buildOperationIdToPathMap()` creates the reverse lookup
- `rewriteOperationIdRefs()` rewrites `(#operationId)` patterns
- Applied as a single pass over the full output for completeness
  (catches references in schema property descriptions, not just
  endpoint descriptions)
@edavidaja edavidaja merged commit f58c582 into main Apr 13, 2026
1 check passed
@edavidaja edavidaja deleted the rewrite-operationid-crossrefs branch April 13, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant