Skip to content

Commit 4a2bc5a

Browse files
committed
renaming/doc updates
1 parent 636bee3 commit 4a2bc5a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

docs/api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ Applies highlighting to all ``<pre><code>...</code></pre>`` blocks on a page.
101101
Attaches highlighting to the page load event.
102102

103103

104-
``registerLanguage(name, language)``
104+
``registerLanguage(languageName, languageGrammar)``
105105
------------------------------------
106106

107107
Adds new language to the library under the specified name. Used mostly internally.
108108

109-
* ``name``: a string with the name of the language being registered
110-
* ``language``: a function that returns an object which represents the
109+
* ``languageName``: a string with the name of the language being registered
110+
* ``languageGrammar``: a function that returns an object which represents the
111111
language definition. The function is passed the ``hljs`` object to be able
112112
to use common regular expressions defined within it.
113113

src/highlight.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -723,15 +723,15 @@ const HLJS = function(hljs) {
723723
/**
724724
* Register a language grammar module
725725
*
726-
* @param {string} name
727-
* @param {LanguageFn} language
726+
* @param {string} languageName
727+
* @param {LanguageFn} languageGrammar
728728
*/
729-
function registerLanguage(name, language) {
729+
function registerLanguage(languageName, languageGrammar) {
730730
var lang = null;
731731
try {
732-
lang = language(hljs);
732+
lang = languageGrammar(hljs);
733733
} catch (error) {
734-
console.error("Language definition for '{}' could not be registered.".replace("{}", name));
734+
console.error("Language definition for '{}' could not be registered.".replace("{}", languageName));
735735
// hard or soft error
736736
if (!SAFE_MODE) { throw error; } else { console.error(error); }
737737
// languages that have serious errors are replaced with essentially a
@@ -741,12 +741,12 @@ const HLJS = function(hljs) {
741741
lang = PLAINTEXT_LANGUAGE;
742742
}
743743
// give it a temporary name if it doesn't have one in the meta-data
744-
if (!lang.name) lang.name = name;
745-
languages[name] = lang;
746-
lang.rawDefinition = language.bind(null, hljs);
744+
if (!lang.name) lang.name = languageName;
745+
languages[languageName] = lang;
746+
lang.rawDefinition = languageGrammar.bind(null, hljs);
747747

748748
if (lang.aliases) {
749-
registerAliases(lang.aliases, { languageName: name });
749+
registerAliases(lang.aliases, { languageName });
750750
}
751751
}
752752

0 commit comments

Comments
 (0)