Skip to content

Update the Language class#3941

Merged
DmitrySharabin merged 1 commit intosimplifyfrom
language-class
May 25, 2025
Merged

Update the Language class#3941
DmitrySharabin merged 1 commit intosimplifyfrom
language-class

Conversation

@DmitrySharabin
Copy link
Member

@DmitrySharabin DmitrySharabin commented May 25, 2025

Summary

  • If a grammar has a base language, it should always be resolved
  • Fix getLanguage(): language can already be a resolved grammar if it is taken from this.languages

With the change, code blocks in HTML, CSS, and JS can be highlighted correctly without needing to specify the base languages (clike and xml):

<script type="module" src="./dist/index.js" data-prism-languages="javascript, css, markup"></script>

Without the change, we need to explicitly specify them:

<script type="module" src="./dist/index.js" data-prism-languages="clike, javascript, css, xml, markup"></script>

- If a grammar has a base language, it should always be resolved
- Fix `getLanguage()`: `language` can already be a resolved grammar if it is taken from `this.languages`
Remove extra line
@github-actions
Copy link

github-actions bot commented May 25, 2025

No JS Changes

Generated by 🚫 dangerJS against 7ee67f8

@DmitrySharabin DmitrySharabin merged commit 7a7979c into simplify May 25, 2025
2 checks passed
@DmitrySharabin DmitrySharabin deleted the language-class branch May 25, 2025 14:35
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