Support Elixir#1084
Open
patrols wants to merge 1 commit into
Open
Conversation
Register the Prism Elixir grammar and add Elixir to the code-block language picker, mirroring the existing Ruby/Kotlin entries. Also adds a unit-test grammar assertion and a sandbox example. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Hey @patrols. I think the best way to go here would be introducing a straightforward way for implementers to customize the list for their app rather than trying to support a large super-set in Lexxy core. |
Author
|
@samuelpecher Yeah, fair enough. no point growing the core list forever, and it all gets bundled eagerly right now anyway. I think Lexxy.configure({ languages: { elixir: "Elixir" } })and the picker merges that on top of the Lexical map + the built-in names, instead of me hardcoding each one. Couple of things I wasn't sure about:
Can rework the PR around whatever you'd prefer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Elixir as a supported code-block language, so it appears in the language picker and gets syntax highlighting.
Why
Elixir was missing from the picker (the dropdown jumps from Diff to Go), so code blocks couldn't be highlighted as Elixir. Prism ships an Elixir grammar, so this is a small, self-contained addition.
How
Mirrors the existing manual language entries (Ruby/PHP/Go/Bash/JSON/Diff/Kotlin):
src/config/prism.js— register the grammar:import "prismjs/components/prism-elixir".src/elements/code_language_picker.js— addlanguages.elixir ||= "Elixir"to the picker (needed because@lexical/code'sCODE_LANGUAGE_FRIENDLY_NAME_MAPdoesn't include Elixir — same reason the other languages above are hand-added). The getter sorts alphabetically, so it slots in automatically.test/javascript/unit/helpers/code_highlighting_helper.test.js— add"elixir"toexpectedGrammarsso the parametric test asserts the grammar loads.test/dummy/app/views/sandbox/_code.html.erb— add an Elixir example (alphabetically between Diff and Go).prismjs/components/prism-elixirhas no extra Prism dependency (norequireincomponents.json), so nothing else needs importing.Testing
yarn test— passes, including the newPrism includes the elixir grammarassertion.yarn lint— clean.yarn build— builds cleanly with the new import.