Package-level declarations

Types

Link copied to clipboard
interface Highlighter

A highlighter defines a mapping from highlighting tags to style strings.

Link copied to clipboard
class Rule
Link copied to clipboard
class Tag

Highlighting tags are markers that denote a highlighting category. They are associated with parts of a syntax tree by a language mode, and then mapped to an actual style by a Highlighter.

Link copied to clipboard
object Tags

The default set of highlighting Tags.

Link copied to clipboard
data class TagStyleRule(val tags: List<Tag>, val class: String)

Properties

Link copied to clipboard

A pre-built Highlighter that maps highlighting tags to tok-* CSS class names.

Link copied to clipboard

The NodeProp that stores highlight rules on node types.

Functions

Link copied to clipboard

Match a syntax node's highlight rules. If there's a match, return its set of tags, and whether it is opaque or inheriting.

Link copied to clipboard
fun highlightCode(code: String, tree: Tree, highlighter: Highlighter, putText: (text: String, classes: String) -> Unit, putBreak: () -> Unit, from: Int = 0, to: Int = code.length)

Highlight the given code string using the provided tree and highlighter, calling putText for each piece of text with its CSS classes, and putBreak at line breaks.

Link copied to clipboard
fun highlightTree(tree: Tree, highlighter: Highlighter, putStyle: (from: Int, to: Int, classes: String) -> Unit, from: Int = 0, to: Int = tree.length)

Highlight the given tree with the given highlighter(s), calling putStyle for each styled range.

fun highlightTree(tree: Tree, highlighters: List<Highlighter>, putStyle: (from: Int, to: Int, classes: String) -> Unit, from: Int = 0, to: Int = tree.length)
Link copied to clipboard

Associates highlighting Tags with node types via a selector spec.

Link copied to clipboard

Associates highlighting Tags with node types via a selector spec, where each entry maps a node selector to a list of Tags.

Link copied to clipboard
fun tagHighlighter(tagRules: List<TagStyleRule>, scope: (NodeType) -> Boolean? = null, all: String? = null): Highlighter

Define a Highlighter from an array of tag/class pairs.

Link copied to clipboard
fun TagStyleRule(tag: Tag, class: String): TagStyleRule