diff --git a/CHANGES.md b/CHANGES.md
index b1413c29a5..308ec5fee1 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -23,6 +23,7 @@ Core Grammars:
- fix(ex) adds support for `?'` char literal and missing `defguardp` keyword [Kevin Bloch][]
- fix(diff) fix unified diff hunk header regex to allow unpaired numbers [Chris Wilson][]
- enh(php) support single line and hash comments in attributes, constructor and functions [Antoine Musso][]
+- fix(leaf) fix bug in Leaf keyword highlighting [Francesco Paolo Severino][]
- enh(json) add json5 support [Kerry Shetline][]
- fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][]
- fix(csharp) Support digit separators [te-ing][]
@@ -44,6 +45,7 @@ CONTRIBUTORS
[Chris Wilson]: https://github.com/sushicw
[Antoine Musso]: https://github.com/hashar
[Chester Moses]: https://github.com/Chester-Moses-HCL
+[Francesco Paolo Severino]: https://github.com/fpseverino
[Kerry Shetline]: https://github.com/kshetline
[SungHyun Kim]: https://github.com/witch-factory
[Adam Lui]: https://github.com/adamlui
diff --git a/src/languages/leaf.js b/src/languages/leaf.js
index a430d0331e..7ae6d86ee1 100644
--- a/src/languages/leaf.js
+++ b/src/languages/leaf.js
@@ -26,7 +26,7 @@ export default function(hljs) {
},
{
scope: 'keyword',
- match: LITERALS.join("|"),
+ match: LITERALS.map(lit => `\\b${lit}\\b`).join("|"),
},
{
scope: 'variable',
diff --git a/test/markup/leaf/default.expect.txt b/test/markup/leaf/default.expect.txt
index 17d6db847e..bea28ee4f6 100644
--- a/test/markup/leaf/default.expect.txt
+++ b/test/markup/leaf/default.expect.txt
@@ -7,7 +7,7 @@
#if(count(visit) == 1):
Hello new user!
-#elseif(title == "Welcome back!"):
+#elseif(index == "Welcome back!"):
Hello old user
#else:
Unexpected page!
diff --git a/test/markup/leaf/default.txt b/test/markup/leaf/default.txt
index 3b643511ba..60dd953179 100644
--- a/test/markup/leaf/default.txt
+++ b/test/markup/leaf/default.txt
@@ -7,7 +7,7 @@
#if(count(visit) == 1):
Hello new user!
-#elseif(title == "Welcome back!"):
+#elseif(index == "Welcome back!"):
Hello old user
#else:
Unexpected page!