From f80f79acdf34a3ec41d5927abccdcbc82a25b3e7 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sat, 8 Feb 2020 17:29:46 -0500 Subject: [PATCH 1/3] language has name attributes now --- 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 4cde5c600d..a7d170ac3d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ New themes: Core Changes: +- every language can have a `name` attribute now () [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 bd15c8393b..ec98519269 100644 --- a/src/highlight.js +++ b/src/highlight.js @@ -952,6 +952,9 @@ https://highlightjs.org/ // entire highlighter lang = PLAINTEXT_LANGUAGE; } + // give it a temporary name it 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 081a0ecc0a..6328dde551 100644 --- a/src/languages/sql.js +++ b/src/languages/sql.js @@ -8,6 +8,7 @@ function(hljs) { var COMMENT_MODE = hljs.COMMENT('--', '$'); return { + name: "SQL", case_insensitive: true, illegal: /[<>{}*]/, contains: [ From d086aa93de3a74e24a8ed839a9a265faf72ad1d9 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sat, 8 Feb 2020 17:30:36 -0500 Subject: [PATCH 2/3] pr # --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a7d170ac3d..e3bc2852e0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,7 +10,7 @@ New themes: Core Changes: -- every language can have a `name` attribute now () [Josh Goebel][] +- 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][] From 06cc46be0d1b5f78b1df2dbfbb4d965d6eca0ca8 Mon Sep 17 00:00:00 2001 From: Egor Rogov Date: Sun, 16 Feb 2020 01:18:38 +0300 Subject: [PATCH 3/3] Fix a typo --- src/highlight.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/highlight.js b/src/highlight.js index ec98519269..596dc4663c 100644 --- a/src/highlight.js +++ b/src/highlight.js @@ -952,7 +952,7 @@ https://highlightjs.org/ // entire highlighter lang = PLAINTEXT_LANGUAGE; } - // give it a temporary name it it doesn't have one in the meta-data + // give it a temporary name if it doesn't have one in the meta-data if (!lang.name) lang.name = name; languages[name] = lang;