Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose navigation functions via the internal module. #2749

Closed

Conversation

brian-montgomery
Copy link

@brian-montgomery brian-montgomery commented Jan 3, 2025

Description

  • What does this PR change? Give us a brief description.

    Currently, if a developer wants to utilize the sidebar config structure to do something custom, there is no way to access that generated config.

    The starlight/utils/navigation module exposes two functions that the <Sidebar> component uses to generate the SidebarEntry[] data structure: getSidebar and getSidebarFromConfig. However, those functions are not exposed publicly to developers. This PR simply exposes those functions via the existing @astrojs/starlight/internal module.

  • Did you change something visual? A before/after screenshot can be helpful.

    No, this is just a developer enhancement for niche scenarios that want to do something custom with the Sidebar configuration.

Copy link

changeset-bot bot commented Jan 3, 2025

⚠️ No Changeset found

Latest commit: 336f19d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jan 3, 2025
@astrobot-houston
Copy link
Collaborator

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

Copy link

netlify bot commented Jan 3, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 336f19d
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67780b8d48b58f000840bc8d
😎 Deploy Preview https://deploy-preview-2749--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@HiDeoo
Copy link
Member

HiDeoo commented Jan 3, 2025

Thanks for your contribution 🙌

The @astrojs/starlight/internal only exposes some internal helpers that are used by Starlight itself or some of its direct dependencies. Exporting new functions that do not match this criteria would break this contract as they are not meant to be used by the end user. That's also why this module is not documented and if we need to expose new functions for the end user, this is definitely something that should be documented.

At the moment, customization in Starlight is done using component overrides and soon through a new API based on middlewares. Your description of the issue you're facing is a bit vague so I think the best approach would be to first start with a new discussion to make sure what you're trying to achieve is not already possible, and if it's not, we can discuss and think how to make it possible in the future, and if it means exposing new functions, these would definitely be documented and not exposed through that module.

Considering all of this, I'm going to close this PR for now. Feel free to open a new discussion so we can discuss further and I hope you understand the reasons behind this decision. Thanks again for your contribution!

@HiDeoo HiDeoo closed this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants