Skip to content

CmText

Unofficial

The document data type used in CodeMirror.

Import:

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

Signature:

export class CmText

Properties

Property Type Description
empty CmText An empty document.
length number The length of the document.
lines number The number of lines in the document.

Methods

Method Returns Description
line(n) Line Get the line at a given 1-based line number.
lineAt(pos) Line Get the line at the given position.
of(text) CmText Create a text from an array of lines.
sliceString(from, to?, lineSep?) string Return the document as a string, using newline characters to separate lines.
toString() string Return the document as a string.