Code highlight highlightjs user documentation,

Source: Internet
Author: User

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.

  • Highlight (name, value, ignore_illegals, continuation)
    Highlight a code block in a specified language
    Parameters:
    Name: language nameValue: the original HTML string.Ignore_illegals: whether to ignore invalid charactersContinuation: whether to continue unfinished Parsing

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

  • HighlightAuto (value, languageSubset)
    Automatically highlight code blocks in a specified language
    Parameters:
    Value: html TagLanguageSubset: Language Array
    Returned value: Object
    Language: The detected language.Relevance: integerValue: highlighted HTML TagSecond_best: the second language used for car inspection. It may be empty.
  • 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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.