Skip to content

Commit

Permalink
Fix highlight js bug with bit arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Feb 29, 2024
1 parent 356d80a commit 27d8ab9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions javascript/highlightjs-gleam.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
hljs.registerLanguage("gleam", function (hljs) {
const KEYWORDS =
"as assert case const fn if import let panic use opaque pub todo type";
const KEYWORDS = {
className: "keyword",
beginKeywords:
"as assert auto case const delegate derive echo else fn if " +
"implement import let macro opaque panic pub test todo type use",
};
const STRING = {
className: "string",
variants: [{ begin: /"/, end: /"/ }],
Expand Down Expand Up @@ -47,7 +51,7 @@ hljs.registerLanguage("gleam", function (hljs) {
hljs.C_LINE_COMMENT_MODE,
STRING,
{
// bit string
// bit array
begin: "<<",
end: ">>",
contains: [
Expand Down Expand Up @@ -85,10 +89,7 @@ hljs.registerLanguage("gleam", function (hljs) {
end: "\\(",
excludeEnd: true,
},
{
className: "keyword",
beginKeywords: KEYWORDS,
},
KEYWORDS,
{
// Type names and constructors
className: "title",
Expand Down

0 comments on commit 27d8ab9

Please sign in to comment.