MarkdownExtension
An extension to TextEditorState that provides markdown functionality. This separates markdown concerns from the core text editor functionality.
Constructors
Properties
Functions
Serializes the document to markdown.
The heading level (1..6) of line, or null when the line is not a heading. Reads the line's HeaderSpanStyle span, so the answer is independent of the display styles in the active configuration.
Returns whether line is currently rendered as a blockquote.
Returns whether line is currently rendered as a bullet-list item.
Returns whether line is currently rendered as a fenced code line.
Returns whether line is currently rendered as an ordered-list item.
The destination URL of the link covering position, or null when the position is not inside a link.
Makes range a hyperlink to url: bakes the configuration's link display style over the text and attaches the LinkSpanStyle that carries the destination through serialization. Both go through the undoable edit pipeline as two recorded operations (the display style and the span), so fully reverting a setLink takes two undo steps.
Adds blockquote rendering (left bar + indented text) to each line in lines that doesn't already have it; removes it from lines that do. Mixed selections enable on every line for predictable toolbar behavior.
Adds bullet-list rendering (gutter dot + hanging indent) to each line in lines that doesn't already have it; removes it from lines that do. Mixed selections enable on every line for predictable toolbar behavior.
Adds fenced-code rendering (monospace text + tinted card with a hairline border) to each line in lines that doesn't already have it; removes it from lines that do. Mixed selections enable on every line for predictable toolbar behavior. Code fences demote any blockquote/list on the same line — the four block styles can't coexist visually.
Makes each line in lines a heading of level (1..6), or removes the heading where every targeted line already carries that exact level. Applying over a different heading level swaps the level. The heading is semantic: it survives configuration changes and exports as # markers regardless of the display style in force. One atomic undo entry covers the whole toggle.
Adds ordered-list rendering (gutter numeral + hanging indent) to each line in lines that doesn't already have it; removes it from lines that do. Mixed selections enable on every line for predictable toolbar behavior. Numbering is recomputed automatically based on contiguous-run position.