Skip to content

Conversation

@RunDevelopment
Copy link
Member

This PR makes the test and example pages use the Autoloader to load language definitions.

Motivation

I wanted to get rid of this copypasted code altogether.


This is based on #1935.

@mAAdhaTTah mAAdhaTTah changed the title The test and example pages using Autoloader Update test and example pages to use Autoloader Sep 3, 2019
@RunDevelopment
Copy link
Member Author

I should have communicated this earlier but this PR has one major issue: Extensions.
When you select an extension like CSS Extras on the test page, the Autoloader will go into an infinite loop loaden prism-css-extras.js about 100/s (localhost). This is because of the way Autoloader decides whether a language has been loaded yet by checking Prism.languages['css-extras'].
The problem: For extensions, this property remains undefined.

If you assume that languages won't be uploaded again after they are loaded, Autoloader could just keep an internal record of every loaded language as an addition to Prism.languages.
This is a breaking change because you won't be able to load a language again after unloading it, but how unloads languages on their website?

I'll implement this soon, so please re-review after that.
@mAAdhaTTah @Golmote

@github-actions
Copy link

github-actions bot commented Oct 5, 2021

No JS Changes

Generated by 🚫 dangerJS against d1d4349

@RunDevelopment
Copy link
Member Author

soon

±2 years.


Since the extension issue has since been solved and the PR has already been approved, I'll just merge this now.

@RunDevelopment RunDevelopment merged commit 3d96eed into PrismJS:master Oct 5, 2021
@RunDevelopment RunDevelopment deleted the test-and-examples-using-autoloader branch October 5, 2021 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants