Skip to content

CmText

Unofficial

The document data type used in CodeMirror.

Import:

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

Signature:

export class CmText

Properties

PropertyTypeDescription
emptyCmTextAn empty document.
lengthnumberThe length of the document.
linesnumberThe number of lines in the document.

Methods

MethodReturnsDescription
line(n)LineGet the line at a given 1-based line number.
lineAt(pos)LineGet the line at the given position.
of(text)CmTextCreate a text from an array of lines.
sliceString(from, to?, lineSep?)stringReturn the document as a string, using newline characters to separate lines.
toString()stringReturn the document as a string.