Skip to content

Cm5Mode<T>

Unofficial

A CodeMirror 5 mode definition for syntax highlighting.

Import:

import type { Cm5Mode } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface Cm5Mode<T>

Properties

Property Type Description
blockCommentEnd? string String that ends a block comment.
blockCommentLead? string String to put at the start of continued lines in a block comment.
blockCommentStart? string String that starts a block comment.
electricChars? string Trigger a re-indent whenever one of the characters in the string is typed.
electricInput? RegExp Trigger a re-indent whenever the regex matches the part of the line before the cursor.
lineComment? string String that starts a line comment.
name? string The name of the mode.

Methods

Method Returns Description
blankLine(state) void Called whenever a blank line is passed over, so that the parser state can be updated.
copyState(state) T Given a state, returns a safe copy of that state.
indent(state, textAfter, line) number Returns the number of spaces of indentation that should be used.
startState() T Produces a state object to be used at the start of a document.
token(stream, state) null | string Reads one token from the stream, optionally updates the state, and returns a style string.

Links to this page: