feat: issue #32 markdown editor for TUI
This commit is contained in:
@@ -33,12 +33,12 @@ rule SidebarNavigation {
|
||||
|
||||
rule OpenEntry {
|
||||
when: TuiKeyPressed(code: "enter")
|
||||
-- Posts open in the rendered markdown preview by default (title +
|
||||
-- textarea still seeded from the persisted form; ctrl+e switches to
|
||||
-- editing). New empty posts created with "n" open in the editor
|
||||
-- instead — there is nothing to preview yet. Images open in the
|
||||
-- terminal image preview. Other entities report that terminal
|
||||
-- editing is not available yet.
|
||||
-- Posts open in the editor by default (title + textarea seeded from
|
||||
-- the persisted form; syntax highlighting and word wrap on; ctrl+e
|
||||
-- switches to the rendered preview). New empty posts created with
|
||||
-- "n" open in the editor as well. Images open in the terminal image
|
||||
-- preview. Other entities report that terminal editing is not
|
||||
-- available yet.
|
||||
ensures: TuiState.editing_post.updated()
|
||||
}
|
||||
|
||||
@@ -50,17 +50,27 @@ rule SaveAndPublish {
|
||||
ensures: PostPersisted()
|
||||
}
|
||||
|
||||
rule WrappedPreview {
|
||||
rule EditorMode {
|
||||
when: TuiKeyPressed(code: "e", modifiers: "ctrl")
|
||||
-- ctrl+e toggles between the read-only word-wrapped Markdown
|
||||
-- preview (the default mode when opening a post — rendered through
|
||||
-- tui-markdown so headings/emphasis/lists are styled) and the
|
||||
-- editing textarea (which cannot soft-wrap, an upstream
|
||||
-- ratatui-textarea limitation); keys in preview never edit content,
|
||||
-- and esc returns to the sidebar from either mode.
|
||||
-- ctrl+e toggles between the syntax-highlighted editor (the default
|
||||
-- mode when opening a post) and the read-only rendered-Markdown
|
||||
-- preview (rendered through tui-markdown so headings/emphasis/lists
|
||||
-- are styled); keys in preview never edit content, and esc returns
|
||||
-- to the sidebar from either mode.
|
||||
ensures: PreviewToggled()
|
||||
}
|
||||
|
||||
rule CodeEditorWrapping {
|
||||
when: TuiState.editing_post.updated()
|
||||
-- The post editor renders the buffer with syntax highlighting
|
||||
-- (markdown with [[macro]] accents for posts, HTML+Liquid for
|
||||
-- templates, Lua for scripts), soft-wraps long lines to the
|
||||
-- viewport width, keeps the cursor's visual row visible while
|
||||
-- scrolling, and highlights the cursor's source line. There is no
|
||||
-- line-number gutter.
|
||||
ensures: TuiState.updated()
|
||||
}
|
||||
|
||||
rule AiQuickAction {
|
||||
when: TuiKeyPressed(code: "g", modifiers: "ctrl")
|
||||
-- One-shot AI post analysis (title/excerpt suggestions). Gated by
|
||||
|
||||
Reference in New Issue
Block a user