Go to file
TEC e4764918b3
Fix incorrect substitution
2022-05-24 00:17:30 +08:00
README.org Fix typo in readme 2021-01-02 02:08:45 +08:00
ox-ansi.el Fix incorrect substitution 2022-05-24 00:17:30 +08:00
screenshot.png Add readme 2020-12-08 03:54:21 +08:00

README.org

You know those fancy shell scripts that produce colourful and pretty output?

Well, I was jealous. Not any more though — I've taken Org's ASCII exporter and added ANSI escape codes all over the place.

You can now write a gorgeous CLI help page in Org and use this to export it for inclusion. Then you can use ox-pandox to create a man page, and org-html-org-export-to-html for online documentation.

One could term this the holy trinity of script documentation 😉.

/tec/ox-ansi/media/branch/master/screenshot.png

Installation

Straight

(use-package ox-ansi
  :straight (:host github :repo "tecosaur/ox-ansi"))

Doom

;; $DOOMDIR/packages.el
(package! ox-ansi
  :recipe (:host github :repo "tecosaur/ox-ansi"))

;; $DOOMDIR/config.el
(use-package! ox-ansi :after org)

Dependences

  • sed

For some reason I seem to have issues directly outputting ASCII escape characters, and so I rely on sed for some light post-processing (for the write-to-file option, write-to-buffer uses replace-re-search-forward).

Notable variables

In addition to most of the ox-ascii settings (renamed), there are a few extra configuration points.

org-ansi-box-style
Set the style of the surrounding box used for code excerpts (among other blocks).
org-ansi-use-face-colours
Whether to grab foreground/background information about headlines, links, etc. and use them in the output.
org-ansi-color-mode
What sort of terminal compatibly / colour space to target. Supports 3-bit (8 colour), 4-bit (16 colour), 8-bit (256 colour), and 24-bit (16m colour) options.