Right now, Prism has a few problems with how languages and plugins are added/loaded. To list a few of those problems in no particular order:
Prism.languages
and Prism.plugins
namespaces.All of these problems come from the fact that Prism instances have no control over their languages/plugins.
This issue proposes a new API to add languages and plugins that can be used to solve all of the above-mentioned problems.
DescriptionInstead of adding languages/plugins directly to Prism.{languages,plugins}
, new functions Prism.{languages,plugins}.add
will be used. The add
functions will take 3 pieces of information:
The add
functions will do 3 things:
/** * @param id The id of the language/plugin. * @param meta Information about the language/plugin. * @param createFn A function that add the language/plugin to the given Prism instance. */ Prism.{languages,plugins}.add( id: string, meta: Meta, createFn: (Prism: Prism) => void ): void; interface Meta { /** * A list of aliases of the current language/plugin. */ alias?: string | string[]; }Usage
Prism.languages.add('my-lang', { alias: 'my-language' }, Prism => { Prism.languages['my-lang'] = { ... }; });
Note that this usage pattern is very compatible with the current way languages/plugins are added.
AdvantagesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4