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

PropertyTypeDescription
blockCommentEnd?stringString that ends a block comment.
blockCommentLead?stringString to put at the start of continued lines in a block comment.
blockCommentStart?stringString that starts a block comment.
electricChars?stringTrigger a re-indent whenever one of the characters in the string is typed.
electricInput?RegExpTrigger a re-indent whenever the regex matches the part of the line before the cursor.
lineComment?stringString that starts a line comment.
name?stringThe name of the mode.

Methods

MethodReturnsDescription
blankLine(state)voidCalled whenever a blank line is passed over, so that the parser state can be updated.
copyState(state)TGiven a state, returns a safe copy of that state.
getType(state)null | stringReturns the token type of the current state, for modes that expose one.
indent(state, textAfter, line)numberReturns the number of spaces of indentation that should be used.
innerMode(state)Cm5InnerModeResultReturns the innermost mode and state at the given state, for modes that wrap other modes.
startState()TProduces a state object to be used at the start of a document.
token(stream, state)null | stringReads one token from the stream, optionally updates the state, and returns a style string.

Links to this page: