You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accepts a language name, or an alias, and a string with the code to highlight.
@@ -32,7 +32,7 @@ Returns an object with the following properties:
32
32
33
33
34
34
``highlightAuto(code, languageSubset)``
35
-
----------------------------------------
35
+
---------------------------------------
36
36
37
37
Highlighting with language detection.
38
38
Accepts a string with the code to highlight and an optional array of language names and aliases restricting detection to only those languages. The subset can also be set with ``configure``, but the local parameter overrides the option if set.
@@ -76,7 +76,7 @@ Configures global options:
76
76
* ``classPrefix``: a string prefix added before class names in the generated markup, used for backwards compatibility with stylesheets.
77
77
* ``languages``: an array of language names and aliases restricting auto detection to only these languages.
78
78
* ``languageDetectRe``: a regex to configure how CSS class names map to language (allows class names like say `color-as-php` vs the default of `language-php`, etc.)
79
-
* ``noHighlightRe``: a regex to configure which CSS classes are to be skipped completely
79
+
* ``noHighlightRe``: a regex to configure which CSS classes are to be skipped completely.
80
80
81
81
Accepts an object representing options with the values to updated. Other options don't change
82
82
::
@@ -85,15 +85,14 @@ Accepts an object representing options with the values to updated. Other options
85
85
tabReplace: ' ', // 4 spaces
86
86
classPrefix: '' // don't append class prefix
87
87
// … other options aren't changed
88
-
})
88
+
});
89
89
hljs.initHighlighting();
90
90
91
91
92
92
``initHighlighting()``
93
93
----------------------
94
94
95
-
Applies highlighting to all ``<pre><code>..</code></pre>`` blocks on a page.
96
-
95
+
Applies highlighting to all ``<pre><code>...</code></pre>`` blocks on a page.
97
96
98
97
99
98
``initHighlightingOnLoad()``
@@ -113,13 +112,21 @@ Adds new language to the library under the specified name. Used mostly internall
113
112
to use common regular expressions defined within it.
114
113
115
114
115
+
``registerAlias(alias|aliases, {languageName})``
116
+
------------------------------------------------
117
+
118
+
Adds new language alias or aliases to the library for the specified language name defined under ``languageName`` key.
119
+
120
+
* ``alias|aliases``: a string or array with the name of alias being registered
121
+
* ``languageName``: the language name as specified by ``registerLanguage``.
122
+
123
+
116
124
``listLanguages()``
117
-
----------------------------
125
+
-------------------
118
126
119
127
Returns the languages names list.
120
128
121
129
122
-
123
130
.. _getLanguage:
124
131
125
132
@@ -132,7 +139,7 @@ Returns the language object if found, ``undefined`` otherwise.
132
139
133
140
134
141
``requireLanguage(name)``
135
-
---------------------
142
+
-------------------------
136
143
137
144
Looks up a language by name or alias.
138
145
@@ -150,5 +157,5 @@ Enables *debug/development* mode. **This mode purposely makes Highlight.js more
150
157
151
158
For example, if a new version suddenly had a serious bug (or breaking change) that affected only a single language:
152
159
153
-
* **In Safe Mode**: All other languages would continue to highlight just fine. The broken language would appear as a code block, but without any highlighting (as if it were plaintext).
160
+
* **In Safe Mode**: All other languages would continue to highlight just fine. The broken language would appear as a code block, but without any highlighting (as if it were plaintext).
154
161
* **In Debug Mode**: All highlighting would stop when an error was encountered and a JavaScript error would be thrown.
0 commit comments