flark library
The Flark editing kernel without a UI: the parse transports, the
FlarkEditor facade with its closed command set and grouped history, and
the projection that hosts paint. Most apps use a host package, or
package:flark/session.dart, which loads and owns the parser itself.
On the Dart VM, createParseBackend returns a native parser. On the web it
throws; load the bundled module with WasmParseBackend.bundled() from
package:flark/wasm.dart instead. Whoever creates a parser owns it and
calls FlarkParseBackend.dispose when done.
Classes
- DeleteBackward
- Delete the previous rendered grapheme (or word), or the selection.
- DeleteForward
- Delete the next rendered grapheme (or word), or the selection.
- DisplayPosition
- A caret position on the projection.
- FlarkCommand
- FlarkDocument
- FlarkEditor
- FlarkEditorSnapshot
- The immutable state a host receives from FlarkEditor. A live snapshot owns a parsed document and projection; a source snapshot deliberately does not, so code that handles both modes cannot accidentally paint stale data.
- FlarkLiveLimits
- Shape eligibility for synchronous projection. Hosts qualify these limits together with FlarkEditor.syncLimit on their actual input/paint path.
- FlarkLiveSnapshot
- FlarkParseBackend
- Parses Markdown source into a RenderModel. Every implementation is synchronous once created; creation may be asynchronous on the web.
- FlarkSelection
- A selection in source UTF-16 offsets. Collapsed when base == extent. Ordinary endpoints are legal caret positions: never strictly inside a hidden range, always on a row's content. Which of several legal offsets a display position holds is the typing context. A caret in an unwritten table cell is no ordinary endpoint: its offset is where its row's written cells end (the closing pipe or the line's end), which several unwritten cells share and which is no caret position of its own, so it carries the cell's projected address. A noncollapsed 0..source.length range explicitly selects the whole source, including block syntax outside the first/last caret spans.
- FlarkSourceSnapshot
- FlarkStyleState
- A snapshot of an inline formatting control, independent of any UI toolkit.
- History
- HistoryEntry
- Indent
- InlineResource
- A parser-owned link, automatic link or image and its resolved destination. Source coordinates are UTF-16. text is visible text, without Markdown.
- InsertText
- Insert text at the caret, replacing the selection.
- MoveCaret
- Move the caret by a unit, optionally extending the selection.
- MoveTableCell
- Move between table cells, retaining addresses of unwritten cells.
- Newline
- Return: a line break, continuing or exiting a list or quote; a paragraph break when paragraph is set. In a fenced code block, Return on a final blank line exits the block; paragraph keeps the break inside code instead.
- Outdent
- Owner
- An inline run that owns content: its full range and its content range.
- Paste
- Paste text as-is at the caret.
- PendingStyle
- A style the next typed character will take, from a formatting command at the caret or from an owner just emptied by a deletion. Part of the state history restores: undo brings back the typing intent, not just the text.
- PlaceCaret
- Place the caret from a display position, taking the anchor from the glyph half the host reports (leadingHalf). Placed where the caret already is, it still takes that context: a pending style ends, and typing after it is an undo step of its own.
- ProjectedRow
- Projection
- ProjectionOptions
- Redo
- RemoveImage
- Remove the complete image containing the selection.
- RemoveLink
- Remove a link's wrapper while preserving its inline content.
- ReplaceRange
- Replace an explicit source range.
- Segment
- One piece of a row's display text and the source it stands for.
- SelectAll
- Select the current rendered fence's contents first. Repeating the command expands to the document. Outside one fence, or in source mode, select the document immediately. Other commands restart this selection sequence.
- SetCodeLanguage
-
Set the caret's fenced block language. Empty means automatic detection;
textdisables highlighting. The tag is ordinary persisted Markdown. - SetHeadingLevel
- Set the heading level of the caret's row (0 = paragraph).
- SetImage
- Insert an image or edit the image containing the selection.
- SetLink
- Insert a link or edit the link containing the selection. Omitted text preserves selected/existing inline Markdown; supplied text is literal.
- SetSelection
- Set the selection to source offsets (made legal).
- SetStyle
- Explicitly enable or disable one inline style, using ToggleStyle's scope. Repeating the same value is an inert, successful no-op: apply returns false without a rejection, notification, or history entry.
- Shell
- A container above a row: quotes, lists and their items, footnote definitions.
- Style
- Inline style bits carried by a segment.
- ToggleStyle
- Toggle an inline style. Mixed selections become uniformly styled. At a caret, keep the existing span-edge and pending-typing behavior.
- ToggleTask
- Toggle a task checkbox on the caret's item.
- Undo
Enums
- Anchor
- Which side of a hidden range a display position resolves to in source.
- FlarkRejection
- FlarkStyleValue
- Formatting of the caret's next input or the visible selected text.
- MoveDirection
- MoveUnit
- RowKind
- ShellKind
Functions
Typedefs
- FlarkListener = void Function()