From 65d46b34f2b91c04c5663061302e69b9320be3cd Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sat, 15 Feb 2020 18:38:54 -0500 Subject: [PATCH] (parser) language grammars have a `name` attribute now (#2400) --- CHANGES.md | 1 + src/highlight.js | 3 +++ src/languages/sql.js | 1 + 3 files changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index f2b85d5c3e..c4ff353ebc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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][] diff --git a/src/highlight.js b/src/highlight.js index 928b036b78..ab0d3404c5 100644 --- a/src/highlight.js +++ b/src/highlight.js @@ -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); diff --git a/src/languages/sql.js b/src/languages/sql.js index 7cf4679368..4b482a6b03 100644 --- a/src/languages/sql.js +++ b/src/languages/sql.js @@ -8,6 +8,7 @@ export default function(hljs) { var COMMENT_MODE = hljs.COMMENT('--', '$'); return { + name: "SQL", case_insensitive: true, illegal: /[<>{}*]/, contains: [