Function highlightTokens

  • This function takes in a TokenStream and returns a string of HTML code.

    This HTML differs slightly from the HTML that's produced by PrismJS. Firstly, it can safely be split into lines with something like html.split('\n'). This is because all span elements are closed and immediately opened again on a line break, which ensures no context is lost when splitting by lines. Secondly, behavior identical to the Highlight Keywords plugin is present by default.

    Parameters

    • tokens: TokenStream

      The tokens you want to highlight.

    Returns string

Generated using TypeDoc