lassik / emacs-live-preview

Live preview by any shell command while editing
https://melpa.org/#/live-preview
ISC License
14 stars 1 forks source link

Preview commands for various tasks #2

Open lassik opened 5 years ago

lassik commented 5 years ago

Preview Unix manual page written in AsciiDoc:

(defun my-live-preview-asciidoc-manpage (src-buf)
  (insert (with-current-buffer src-buf (buffer-string)))
  (shell-command-on-region
   (point-min) (point-max)
   "asciidoctor -b manpage -o - - | mandoc"
   (current-buffer))
  (Man-fontify-manpage))

MacOS packages: brew install asciidoctor mandoc

lassik commented 5 years ago

Preview Unix manual page written directly in nroff using man/mdoc macros:

(defun my-live-preview-manpage (src-buf)
  (insert (with-current-buffer src-buf (buffer-string)))
  (shell-command-on-region (point-min) (point-max) "mandoc" (current-buffer))
  (Man-fontify-manpage))
lassik commented 5 years ago

One can also use nroff -man instead of mandoc in the above shell commands. Formatting will be slightly different.