Skip to content

[lexical-code] Breaking Change: Extract Prism code highlighting to @lexical/code-prism (with internal module @lexical/code-core to avoid circular import)#8198

Merged
etrepum merged 9 commits intofacebook:mainfrom
etrepum:extract-prism-from-code
Mar 8, 2026

Conversation

@etrepum
Copy link
Collaborator

@etrepum etrepum commented Mar 8, 2026

Breaking Changes

Imports of Prism highlighting functionality should be changed from @lexical/code to @lexical/code-prism. These deprecated exports will be available for the next few versions of lexical (roughly ~0.47.0) to ease the transition.

  • PrismTokenizer
  • registerCodeHighlighting
  • Tokenizer
  • CODE_LANGUAGE_FRIENDLY_NAME_MAP
  • CODE_LANGUAGE_MAP
  • getCodeLanguageOptions
  • getCodeLanguages
  • getCodeThemeOptions
  • getLanguageFriendlyName
  • isCodeLanguageLoaded
  • loadCodeLanguage
  • normalizeCodeLang (also renamed to normalizeCodeLanguage in the move)

The dependency from @lexical/markdown to @lexical/code has been changed to a new (temporary) @lexical/code-core package to avoid a transitive dependency on Prism. If you are directly using @lexical/code functionality without an explicit dependency on @lexical/code you may need to add one to your package.json (and/or change the dependency to @lexical/code-core for now)

Previously deprecated exports from @lexical/code that were missing the $ prefixes have been removed.

Description

Moves the functionality from @lexical/code to internal package @lexical/code-core so that @lexical/code can maintain short term export compatibility for highlighting functionality.

Moves all Prism highlighting code to an independent @lexical/code-prism package

Closes #8197
Closes #5381

Test plan

Existing e2e, unit, and integration tests pass.

etrepum added 2 commits March 8, 2026 12:05
…exical/code-prism (with internal module @lexical/code-core to avoid circular import)
@vercel
Copy link

vercel bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Mar 8, 2026 7:54pm
lexical-playground Ready Ready Preview, Comment Mar 8, 2026 7:54pm

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 8, 2026
@etrepum etrepum added this pull request to the merge queue Mar 8, 2026
Merged via the queue into facebook:main with commit a2546bd Mar 8, 2026
37 checks passed
@etrepum etrepum mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: prismjs is included as a dependency of @lexical/markdown

2 participants