feat(ApiLink): export resolveApiLink for shared resolution logic#92
Open
viktorkombov wants to merge 3 commits into
Open
feat(ApiLink): export resolveApiLink for shared resolution logic#92viktorkombov wants to merge 3 commits into
viktorkombov wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes <ApiLink /> resolution logic (URL construction, ApiLink index lookup, and label computation) into a new exported resolveApiLink() function so the same behavior can be reused by non-Astro tooling (e.g., docs-template’s build-time Markdown generator).
Changes:
- Refactors
ApiLink.astrointo a thin renderer that delegates all link resolution toresolveApiLink(). - Adds exported prop/result types (
ApiLinkProps,SassLinkProps,TypeDocLinkProps,ApiLinkResult) alongside the new resolver inapi-link-index.ts. - Exposes
./components/mdx/ApiLink/api-link-indexviapackage.jsonexports for external consumers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/components/mdx/ApiLink/ApiLink.astro | Removes in-component resolution logic and renders based on resolveApiLink() results. |
| src/components/mdx/ApiLink/api-link-index.ts | Introduces exported resolveApiLink() and related public types to share resolution logic across renderers. |
| package.json | Adds a package export for api-link-index.ts to allow external import of the shared resolver/types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Moves all resolution logic (URL construction, index lookup, display label computation) from
ApiLink.astrointoapi-link-index.tsas a new exportedresolveApiLink()function.ApiLink.astrobecomes a thin renderer that just calls it and outputs HTML.Also exports the prop types (
ApiLinkProps,SassLinkProps,TypeDocLinkProps) and result type (ApiLinkResult), and adds the./components/mdx/ApiLink/api-link-indexpackage export.Why:
docs-template's LLM markdown generator needs to convert<ApiLink>MDX source text into markdown links at build time, using identical resolution logic to the component. Without this, the logic would have to be duplicated and maintained separately.