Code highlight highlightjs user documentation,
Usage
<link rel="stylesheet" href="../../assets/highlight/styles/default.css">
<script type="text/javascript" charset="UTF-8" src="../../assets/highlight/highlight.pack.js"></script>
API
The exposed methods are stored in hljs objects.
Returned value: Object
Language: The specified language, which is consistent with the input.
Relevance: integer
Value: The processed Korean HTML string
Top: top of the current mode stack
FixMarkup (value)
Post-highlighted tags, such as replacementTAB
,<br>
The configuration items are set in configure.
HighlightBlock (block)
The application is highlighted on a DOM node containing code.
Configure (options)
Global Configuration
TabReplace: character used to replace the TAB string
UseBR: A switch option used to generate<br>
Replace the characters of the new line.<pre>
Useful when Packaging
ClassPrefix: A string marker before the loading class name. to be compatible with the style sheet
Ages: an array of language names or aliases. Automatic Detection is used for these languages.
hljs.configure({
tabReplace: ' ', // 4 spaces
classPrefix: '' // don't append class prefix
// … other options aren't changed
})
hljs.initHighlighting();
InitHighlighting ()
In<pre><code>..</code></pre>
Highlight applications in a region
InitHighlightingOnLoad ()
Bind highlighted to page loading events
RegisterLanguage (name, language)
Add a support language for internal use in most cases
Name: name of the supported language
Language functions
Listages ()
Back to language name list
GetLanguage (name)
Returns an object by name or anonymous search language. Otherwise, null is returned.
References
- Http://highlightjs.readthedocs.org/en/latest/api.html