Skip to content

Conversation

vrugtehagel
Copy link
Contributor

@vrugtehagel vrugtehagel commented Aug 16, 2024

Resolves #47.

Adds a languages option to force-load languages before the init callback. Minor restructuring has been done to get the plugin in functional format, in order to allow for the init callback to run after the loading of the languages.

Example usage in an .eleventy.js config file:

export default function(eleventyConfig){
	eleventyConfig.addPlugin(SyntaxHighlight, {
		languages: ['css-extras', 'ruby'],
		init: function({Prism}){
			// do stuff with Prism.languages.ruby…
		}
	})
};

PS: The diff looks rather large due to an indentation change; please toggle "hide whitespace" to see the actual changes.

@vrugtehagel vrugtehagel changed the title Open option to load languages explicitly Add option to load languages explicitly Aug 16, 2024
@vrugtehagel
Copy link
Contributor Author

@zachleat is this something you're interested in? Can I do something to get the ball rolling on this one?

@zachleat zachleat added this to the Syntax Highlight v5.0.1 milestone May 1, 2025
@zachleat zachleat merged commit 50c00ba into 11ty:master May 1, 2025
@zachleat
Copy link
Member

zachleat commented May 1, 2025

Planning on shipping this with v5.0.1 thank you!

@zachleat zachleat mentioned this pull request Aug 1, 2025
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.

BUG / FR / documentation: prism loading - possibility to load other languages; other prism components;
2 participants