From 2f1d226f6baaafec34b5b3623ba6c9df9aaa003b Mon Sep 17 00:00:00 2001 From: t Date: Tue, 24 Nov 2026 22:50:09 -0700 Subject: Render Markdown in the editor and add a terminal launcher Show links, images, quotes, rules and YAML frontmatter as formatted text, revealing the source while the caret is on their line. Images load only from local files and are never fetched. Store frontmatter ahead of the hidden comment block so the file's first line stays a YAML opener. Files saved the old way still open. Add bin/write_away to launch or focus the app from a shell. --- src/doc.zig | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 7 deletions(-) (limited to 'src/doc.zig') diff --git a/src/doc.zig b/src/doc.zig index 3860809..2320a6a 100644 --- a/src/doc.zig +++ b/src/doc.zig @@ -1,6 +1,7 @@ //! The document model and the file format. Pure Zig, no AppKit: `zig build test` covers it. const std = @import("std"); const ghost_io = @import("ghost_io.zig"); +const markdown = @import("markdown.zig"); const mem = std.mem; const Allocator = mem.Allocator; @@ -161,8 +162,10 @@ pub fn suggestion(line: []const u8) ?[]const u8 { // // v2 puts optional Overflow and write_away comments before the visible Markdown. One LF // separates the comments when both are present; two LFs separate the last comment from -// the exact visible bytes. Legacy comments were trailers. Offsets always address the full -// editor body, so v2 ghosts must be restored before the alternatives are reanchored. +// the exact visible bytes. YAML frontmatter is those bytes' one exception: it stays on the +// file's first line and the comments follow it. Legacy comments were trailers. Offsets +// always address the full editor body, so v2 ghosts must be restored before the +// alternatives are reanchored. const overflow_mark = ""; // legacy const overflow_open = "