mdedit

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package mdedit is a keelson app for writing Obsidian-flavored markdown beside its rendered form. The source pane is a plain monospace TextEdit, the preview is a markdown.Doc reparsed whenever the buffer changes, and the caret drives the preview's scroll at heading granularity.

The app is a composition of pieces that already existed — the obsidian goldmark stack, the markdown widget, the ADR-0130 TextEdit seam, the clipboard Powerbox — and adds no IDL method, no Rust and no dependency. ADR-0178 records the decision, the measured reparse costs behind the update policy, and what the later milestones reach; this package re-argues none of it.

The first cut has no file I/O by design. Text arrives through egui's own paste, which is the widget's business and needs no capability, and leaves through clipboard.write. The buffer is persisted to the app's own keelson store — not the filesystem — so it survives the window.

Two constraints shape the implementation and are easy to undo by accident: markdown.Parse issues FFI opcodes as it lowers the AST, so it may only run on the render goroutine; and everything that reaches the bus runs OFF it, because a request blocks until the broker answers or the request times out.

Lifecycle: Mount captures the id stack, logger, bus and storage and starts the restore; Frame renders inside the host-owned window; Unmount persists the buffer one last time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the per-window mdedit instance.

func (*App) Frame

func (inst *App) Frame(ctx app.FrameContextI) (err error)

Frame renders the app body. The host has already pre-pushed a window-unique salt onto inst.ids (ADR-0026 §SD9), so the app must not Reset() the stack or wrap the body in its own instance salt.

func (*App) Manifest

func (inst *App) Manifest() (m app.Manifest)

func (*App) Mount

func (inst *App) Mount(ctx app.MountContextI) (err error)

func (*App) Unmount

func (inst *App) Unmount(ctx app.MountContextI) (err error)

Unmount persists the buffer one last time, synchronously. Every other persist runs off the render thread to keep a stalled bus out of the frame budget; this one cannot, because a goroutine started here would outlive the window and have nothing left to report to. A store that does not answer costs the close one request timeout — the trade the other way loses the document.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL