md-aio
v0.2.0
Published
Read a whole folder of Markdown as one document in browser columns, with live reload; plus md-aio/render, the same Markdown-to-HTML renderer for servers.
Maintainers
Readme
md-aio
All-in-one Markdown viewer for the browser: every Markdown file in a folder, rendered, laid out across side-by-side follow columns that turn as one long page. A small Bun server with a client-rendered page.
Run
md-aio C:\Code\cnc\docs # every .md under the folder
md-aio C:\Code\cnc\docs\spec.md # one document
md-aio C:\Code\cnc\docs --exclude drafts/ # leave paths out (repeatable)All windows share one local server on port 7878 (MD_AIO_PORT to change it). The first md-aio starts it with bgrun as the process md-aio (bgrun md-aio --logs, bgrun --stop md-aio); later calls only open a window. Each window's view (folder, file, excludes) travels in its URL as a signed token (?v=…, HMAC with a key in %LOCALAPPDATA%\md-aio\auth.key), so a window survives a server restart and no other page or program can point the server at another folder. Links without a valid token get "reopen with md-aio". The server runs from its own folder and watches a folder only while a window shows it, so viewed folders can still be renamed or deleted. Run the server by hand with bun server.ts --serve. Columns are about 80 characters wide, like an editor (the width box, [ / ], or &width=100 in a URL; remembered), and as many fit across the window as its width allows. A document that fits in fewer columns uses only those, at the same width, centred.
Windows open filling the screen with a small margin, in Chrome with a user-data folder of md-aio's own (%LOCALAPPDATA%\md-aio\browser), so they share no profile with other Chrome windows. MD_AIO_BROWSER and MD_AIO_PROFILE override the browser and the folder.
Keys: every step turns a whole page (all columns at once): j/k, arrows, PgDn/PgUp, Space/Shift+Space, or one wheel notch or swipe. g/G go to the start/end, [ / ] make columns 10 characters narrower / wider. Ctrl+wheel or Ctrl +/−/0 change the text size (default 13px, remembered).
Clicking a link to another Markdown file (relative, or /… from the window's folder) opens that file in a new window on top.
Math in $…$, $$…$$, \(…\) and \[…\] renders with KaTeX; an inline $…$ needs a space or punctuation outside it, so prices like "$5 and $10" stay text. Body font: Open Sans. Files reload live on save.
Editor sync: curl -X POST -d '{"path":"C:/docs/chapters/01-intro.md","line":40}' "http://127.0.0.1:7878/cursor?v=<the window's token>" scrolls every window that shows that file to the block and highlights it (path may be relative if you also send root).
Outline sidebar
Press o to show or hide the narrow outline on the left (hidden initially). It lists
level 1–3 headings in document order, grouped by Markdown file, including all files
in the current folder view. Click any heading to turn to its page. The heading
at the current page position is indicated as you page with the keyboard or wheel.
The original fixed-width columns automatically re-fit the space beside the sidebar.
Search across the open folder
Press / to open the search field. Enter a literal phrase; matching is
case-insensitive and includes every rendered Markdown file currently visible
(the filename filter still applies). All matches are highlighted; the counter
shows the selected occurrence, e.g. 3 of 17. Press Enter in the field to
return keyboard focus to the reader, then n and N to turn to the next and
previous matches, wrapping at either end. The ↑/↓ buttons work while the field
has focus. Press Escape to clear matches, remove highlighting, and close the
search field. Search is local to the already loaded document; no outside requests.
Recently changed blocks
On WebSocket live reload (or reconnection), added and edited rendered text
blocks get a small left-hand bar for up to 60 seconds, fading at the end.
The initial load never highlights anything. Press c to toggle the
Recently changed sidebar list, independently of o (both can be open).
It keeps the last 20 added/edited blocks, newest first, with each file and
containing heading. Click an item to turn to its location. The history remains
after the bar expires. Moves and unchanged blocks are not marked, and deleted
blocks have no location to mark. The list and outline are hidden initially.
The new navigation is implemented by public/logic.js, which the local Bun
server serves with the other scripts. Unit tests run with
bun test tests/logic.test.ts (or an equivalent Node test port when Bun is
unavailable). The alternate experimental ?layout=columns remains unchanged;
these new controls are for the default follow-column viewer.
