diff options
| author | t <t@tjp.lol> | 2026-11-24 22:50:09 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-11-24 23:31:03 -0700 |
| commit | 2f1d226f6baaafec34b5b3623ba6c9df9aaa003b (patch) | |
| tree | 4dad14862384c296aaf7a2b6ac69dab0055486cf /README.md | |
| parent | 17e3a3589d8482f545bb5956a4f7ea01c646698f (diff) | |
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.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 42 |
1 files changed, 39 insertions, 3 deletions
@@ -26,6 +26,17 @@ zig build test # the document model, then the app driven with no A normal launch reopens the last file you had open, using its current contents on disk. On the first launch, after **File → New**, or if the file can’t be read, you get an empty **Untitled** draft instead. Opening a file explicitly takes precedence. Unsaved text is not restored. +### Launch from the terminal + +With `Write_Away.app` in `/Applications`, install the launcher into a directory on your `PATH` (here, `~/.local/bin`): + +```sh +mkdir -p "$HOME/.local/bin" +install -m 755 bin/write_away "$HOME/.local/bin/write_away" +write_away # launch or bring the editor forward +write_away "my draft.md" # open an existing file +``` + ## Using it | Keys | What happens | @@ -47,8 +58,16 @@ Right-click the page for alternatives, AI alternatives, ghost/revive, or Overflo Matched `**strong**`, `_emphasis_`, `***both***`, `~~strikethrough~~`, and inline code spans render on the page. Move the caret inside a span to see and edit its delimiters. Saving keeps the Markdown source, not a rich-text conversion. +`[Links](with/targets)` show as their underlined text. Move the caret inside one to see its brackets and target. Reference links stay as written, and a link isn’t clickable yet. + +An image alone on its line (``) shows as the picture, fitted to the column and never enlarged past its own size. Click it, or move the caret onto its line, and the source comes back in its place. Pictures are read from this Mac only: an absolute path, or one relative to the folder the piece is saved in, so an unsaved piece shows none. Nothing is fetched. An image among other text, a remote URL, or a file that can’t be read stays as written. + +A line starting with `> ` is a quote: a bar stands in for the marker and the text keeps its indent. A line of three or more `-`, `*` or `_` (all the same, spaces between them allowed) is a rule across the column. Unbroken hyphens directly under a line of text are the exception: Markdown would make that line a heading, so they stay as written. Put the caret on a quote or rule to see its source. Nested quotes stay as written. + Fenced code blocks (three or more backticks or tildes, with an optional language) sit on a darker panel, and nothing inside one is read as Markdown. The fence lines show while the caret is in the block. A block with no closing fence runs to the end of the piece. +YAML frontmatter is shown the same way, with its `---` lines as the fences. It counts only when the first line is `---` and a later line of `---` or `...` closes it; its contents are not parsed. + ## The Lab Choose **Lab** in the bottom bar or press **Ctrl+Shift+L** (also in the Write menu); the shortcut leaves read mode if needed. During a review, use **Ctrl+Shift+N** for Next, **Ctrl+Shift+K** for Keep, **Ctrl+Shift+P** for Apply rest, and **Ctrl+Shift+O** for Discard/Original. The in-window chooser has six editing passes and a row of trim strengths. Use the arrow keys to move, Return to choose, or Escape to go back to the draft. A pass can mark weak, long, or convoluted sentences, changes of tone, or filler. Punctuation and typo fixes are proposals until you apply them. **Next** visits the next passage; **Keep** leaves it alone. @@ -81,8 +100,25 @@ escapes. All hidden text is still readable in the file source. Write_Away preserves the visible bytes exactly after the blank line that separates the comments from the draft. A file with no Overflow, alternatives or ghosts is saved -unchanged. With metadata present, comments precede even YAML frontmatter; its bytes -are preserved, but tools that require frontmatter on the first line may not recognize it. +unchanged. + +YAML frontmatter stays on the first line: the comments go directly after the line that +closes it, and the rest of the draft follows their blank line. + +```markdown +--- +title: A draft +--- +<!-- write_away {"v":2,"groups":[…]} --> + + +# A draft +``` + +Files saved earlier with the comments above the frontmatter still open, and move to this +layout on the next save. If the closing line is the last thing in the file with no line +break after it, or ghosting leaves the published text without frontmatter, the comments +go first as before. Files record UTF-8 byte offsets into the restored editor body. While editing, ghosts are attributes on the text itself; Save computes fresh offsets. A fully ghosted alternative stays ghosted when swapped. If a replacement crosses a ghost boundary, revive the ghosted part first: Write_Away won’t guess which words in another version should be hidden. @@ -99,7 +135,7 @@ A separate Markdown view, source-stripped public export, sharing/posting, deleti ## The code - `src/doc.zig` and `src/ghost_io.zig`: variants, recoverable ghosts, and the Markdown format. -- `src/markdown.zig`: matches inline formatting delimiters in the editor’s UTF-16 text. +- `src/markdown.zig`: matches inline formatting and link delimiters in the editor’s UTF-16 text, and tells fences, frontmatter and rules from text a line at a time. - `src/lab.zig` and `src/lab_ui.zig`: map model suggestions to draft passages and present them for review. - `src/main.zig`: the app. The page is an `NSTextView`; two custom text attributes mark groups and ghosts, and everything drawn is derived from them. |
