Skip to content

feat(ApiLink): add kind="sass" for SASS API documentation links#45

Open
dobromirts wants to merge 1 commit into
masterfrom
dtsvetkov/add-sass-api-links
Open

feat(ApiLink): add kind="sass" for SASS API documentation links#45
dobromirts wants to merge 1 commit into
masterfrom
dtsvetkov/add-sass-api-links

Conversation

@dobromirts
Copy link
Copy Markdown
Contributor

  1. Extends ApiLink with a new kind="sass" variant.
  2. Adds module (SASS module name) and type (anchor without #) props, and sassApiUrl?: string to PlatformContext. Labels are wrapped in by default, matching TypeDoc link behaviour.

@dobromirts dobromirts requested a review from viktorkombov May 21, 2026 13:35
@dobromirts dobromirts added the ❌ status: awaiting-test PRs awaiting manual verification label May 21, 2026
@ChronosSF ChronosSF added ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification labels May 21, 2026
@ChronosSF ChronosSF requested a review from Copilot May 21, 2026 15:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the MDX ApiLink component to support linking into SASS API documentation by introducing a new kind="sass" variant and a corresponding optional sassApiUrl in PlatformContext.

Changes:

  • Added sassApiUrl?: string to PlatformContext for configuring a SASS API docs base URL.
  • Extended ApiLink with kind="sass", plus module and code props, and adjusted label rendering for sass links.
  • Refactored ApiLink URL/label construction to handle both TypeDoc kinds and the new sass kind.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/types.ts Adds sassApiUrl?: string to the platform context to support SASS API link generation.
src/components/mdx/ApiLink/ApiLink.astro Adds kind="sass" handling, new props, and conditional code formatting for sass labels.
Comments suppressed due to low confidence (1)

src/components/mdx/ApiLink/ApiLink.astro:119

  • type was made optional to support kind="sass", but the non-sass branch still builds baseType via ${prefix}${type} when prefixed is true. If type is omitted this will produce Igrundefined (and invalid TypeDoc slugs/labels) instead of failing fast. Consider modeling Props as a discriminated union (sass vs typedoc) so type stays required for non-sass kinds, or add a runtime guard that errors when type is missing outside of kind="sass".
    const pkgConfig  = apiPackages[pkg] ?? apiPackages['core'];
    const baseType   = prefixed ? `${prefix}${type}` : (type ?? '');
    const segment    = KIND_SEGMENT[kind];

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +112 to +115
if (kind === 'sass') {
const anchor = type ? `#${type}` : '';
url = `${ctx.sassApiUrl ?? ''}/${module ?? ''}${anchor}`;
displayLabel = label ?? type ?? module ?? '';
Comment thread src/lib/types.ts
@@ -63,4 +63,5 @@ export interface PlatformContext {
forums: string;
repoSamples: string;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✅ status: verified Applies to PRs that have passed manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants