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

Re-add getAvailableLanguages, getAvailableThemes, languageIsAvailable and themeIsAvailable #23

Merged
merged 6 commits into from
Sep 29, 2024

Conversation

s3ththompson
Copy link
Contributor

@s3ththompson s3ththompson commented Jul 24, 2024

This PR re-adds getAvailableLanguages, getAvailableThemes, languageIsAvailable and themeIsAvailable and updates their behavior to correctly read all languages/themes, rather than just currently loaded ones.

Even though individual languages and themes are now lazy-loaded by Shiki, these methods allow an application to introspect the possible assets available for lazy-loading.

This functionality is essential for an application to present a dropdown list of highlighting options to a user, and to validate user-selected languages/themes.

I know you just released a new major version without these methods, but it would not be a breaking change to re-add them. I hope you'll consider this, despite the churn. Thanks!


As an implementation detail, this PR differentiates internally between base languages (e.g. javascript) and aliases (e.g. javascript and js). getAvailableLanguages returns base languages, while languageIsAvailable checks against all aliases.

(This PR also fixes a small nit: symfony/process was not required as a dependency.)

@riasvdv
Copy link
Member

riasvdv commented Jul 24, 2024

Seems like the tests on older PHP versions are failing, can you check?

@s3ththompson
Copy link
Contributor Author

Oops, looks like symfony/process needs to be ^5.4|^6.4|^7.1 to support all the way back to PHP 7.4. Should be fixed now!

@riasvdv riasvdv merged commit dc2305e into spatie:main Sep 29, 2024
10 checks passed
@riasvdv
Copy link
Member

riasvdv commented Sep 29, 2024

Thanks!

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.

2 participants