Skip to content

Commit

Permalink
better regex
Browse files Browse the repository at this point in the history
  • Loading branch information
timothymcmackin committed Feb 26, 2024
1 parent 0249c4f commit 33b1543
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/theme/languages/prism-michelson.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,7 @@

// Catch the init keywords both at the beginning of a line
// and when there is an opening brace and/or whitespace
const initKeywordsRegex = new RegExp("(?:" +
initKeywords
.map((kwd) => ([
"^" + kwd, // Start of line
"^{?\\s+?" + kwd, // with brace or whitespace
]))
.flat()
.join("|") +
")\\b", "gm");
const initKeywordsRegex = new RegExp(`(?<=^\\s*{?\\s*)(${initKeywords.join('|')})\\b`, "gm");

Prism.languages.michelson = {
'type': {
Expand Down

0 comments on commit 33b1543

Please sign in to comment.