TUI::MarkdownEdit
Inherits TUI::TextEdit < TUI::Scrollable < Reference < Object
A TextEdit that highlights Markdown syntax as you type — headings, list markers, and blockquote prefixes (line-prefix syntax, detected from one line alone), plus bold/italic/strikethrough/inline-code spans within each line. Deliberately does NOT track multi-line constructs like fenced code blocks — that would require re-parsing surrounding lines on every keystroke, a much heavier cost for a live editor than a read-only viewer pays once per render. Reuses Markdown::Layout::Config's existing heading/list/quote style choices so a highlighted line looks consistent with how MarkdownView would eventually render the same content, rather than inventing a second, unrelated palette.
Inline spans are found with a small local scanner rather than reusing
Markdown::Inline.parse — that scanner strips delimiters
(**bold** becomes the 4-character-shorter "bold") for MarkdownView,
a read-only renderer where the raw source never needs to stay
editable. TextEdit's #highlighter contract requires every character
of the input line back, unchanged, just re-styled (see TextEdit's
#highlighter doc comment) — an editor needs **/` to stay
visible and at their original column so the cursor and edits still
land in the right place. #inline_cells below styles delimiters
(dimmed) and their contents (bold/italic/code) separately without
ever removing a character.
This is TextEdit's syntax-agnostic #highlighter hook wired to one particular syntax, not a special case TextEdit itself knows about — any other syntax could plug in the same way via its own subclass.