Skip to content

Commit

Permalink
(parser) language grammars have a name attribute now (highlightjs#2400
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joshgoebel authored and taufik-nurrohman committed Feb 18, 2020
1 parent cab7d36 commit 088821e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -10,6 +10,7 @@ New themes:

Core Changes:

- every language can have a `name` attribute now (#2400) [Josh Goebel][]
- improve regular expression detect (less false-positives) (#2380) [Josh Goebel][]
- make `noHighlightRe` and `languagePrefixRe` configurable (#2374) [Josh Goebel][]

Expand Down
3 changes: 3 additions & 0 deletions src/highlight.js
Expand Up @@ -719,6 +719,9 @@ const HLJS = function(hljs) {
// entire highlighter
lang = PLAINTEXT_LANGUAGE;
}
// give it a temporary name if it doesn't have one in the meta-data
if (!lang.name)
lang.name = name;
languages[name] = lang;
lang.rawDefinition = language.bind(null,hljs);

Expand Down
1 change: 1 addition & 0 deletions src/languages/sql.js
Expand Up @@ -8,6 +8,7 @@
export default function(hljs) {
var COMMENT_MODE = hljs.COMMENT('--', '$');
return {
name: "SQL",
case_insensitive: true,
illegal: /[<>{}*]/,
contains: [
Expand Down

0 comments on commit 088821e

Please sign in to comment.