MarkdownExtension

class MarkdownExtension(val editorState: TextEditorState, initialConfiguration: MarkdownConfiguration = MarkdownConfiguration.DEFAULT, var imageProvider: ImageProvider? = null)(source)

Reads and writes the document as markdown: the entry point for using the editor as a markdown editor. The styles the document is rendered and recognised with are the state's richTextStyles; markdownConfiguration holds the syntax choices. The block toggles and queries live on the state (toggleBulletList, headerLevel, setLink and the rest, in com.darkrockstudios.texteditor.state); the members here forward to them for one release.

Constructors

Link copied to clipboard
constructor(editorState: TextEditorState, initialConfiguration: MarkdownConfiguration = MarkdownConfiguration.DEFAULT, imageProvider: ImageProvider? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The syntax choices export writes in and import reads by default.

Link copied to clipboard

The styles under their old names; read TextEditorState.richTextStyles.

Functions

Link copied to clipboard
Link copied to clipboard

Serializes the document to markdown.

Link copied to clipboard
fun headerLevel(line: Int): Int?
Link copied to clipboard
fun importMarkdown(markdownText: String, paragraphSeparator: ParagraphSeparator = markdownConfiguration.paragraphSeparator)

Replaces the document with markdownText. paragraphSeparator says how the text's blank lines are read (see ParagraphSeparator); it defaults to the configuration's, and a host opening a file written under the other rule passes that rule here.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun isCodeFence(line: Int): Boolean
Link copied to clipboard
Link copied to clipboard
fun linkAt(position: CharLineOffset): String?
Link copied to clipboard
fun listLevel(line: Int): Int?
Link copied to clipboard
Link copied to clipboard
fun setCodeFenceLanguage(line: Int, language: String?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun toggleHeader(lines: IntRange, level: Int)
Link copied to clipboard
Link copied to clipboard