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

Core: Added setLanguage util function #3167

Merged
merged 4 commits into from Nov 3, 2021

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Oct 25, 2021

This PR adds a setLanguage to Prism.util.

I also changed the regex we use to detect language-xxxx classes. It now uses whitespace boundaries instead of word boundaries. This is consistent with the className/classList spec.

(I also slightly simplified the getLanguage language.)

The File Highlight plugin now uses Prism.util.setLanguage instead of its own implementation.


This fixes #2383.

@github-actions
Copy link

@github-actions github-actions bot commented Oct 25, 2021

JS File Size Changes (gzipped)

A total of 2 files have changed, with a combined diff of -59 B (-1.4%).

file master pull size diff % diff
components/prism-core.min.js 3.08 KB 3.09 KB +7 B +0.2%
plugins/file-highlight/prism-file-highlight.min.js 1.14 KB 1.08 KB -66 B -5.8%

Generated by 🚫 dangerJS against 73a89c4

@RunDevelopment RunDevelopment merged commit b631949 into PrismJS:master Nov 3, 2021
12 checks passed
@RunDevelopment RunDevelopment deleted the set-language branch Nov 3, 2021
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.

1 participant