How I write AsciiDoc articles in Leo Editor (Ctrl-/ → HTML → live preview)

12 views
Skip to first unread message

zhaohe wang

unread,
Dec 1, 2026, 10:02:08 AM (19 hours ago) Dec 1
to leo-editor
Hi everyone,

I wrote a short guide on writing AsciiDoc articles in Leo Editor and thought it might be useful here:

https://wangzhaohe.github.io/swot-learning/leo-editor/Writing-AsciiDoc-in-Leo-Editor.html

The setup is simple: an `@button ascii` (Ctrl-/) compiles the current `@adoc` node and opens a live preview, reusing one `live-server` per output file so re-running the button just refreshes the same tab.

The one gotcha worth mentioning: Leo's `compute_opath()` strips up to three extensions (`aaaa.js.adoc` → `aaaa.html`), while Asciidoctor's `xref` only replaces the last `.adoc` (`aaaa.js.html`). The button renames Leo's output with `os.replace()` so links keep working and live-server watches the right file.

Global attributes, a TOC toolbar, and the CSS tweaks live in `options.rb` and `asciidoctor-default.css`. Full code and screenshots are in the post above.

Comments and suggestions welcome.

Best,
wangzhaohe
Reply all
Reply to author
Forward
0 new messages