Skip to content
Pretty-print text documents on a terminal using pandoc
Lua
Branch: master
Clone or download
camilleoudot Merge pull request #2 from bbailleux/master
Line folding in generated table
Latest commit 93c5849 Oct 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
res
test-documents
LICENSE.txt
README.md
terminal.lua Line folding in generated table Oct 5, 2018

README.md

Pandoc Terminal Writer -- Pretty-print text documents on a terminal

Presentation

This is a custom writer (output driver) for pandoc written in lua. When chosen as output format, it will pretty-print the input document on the terminal. It makes heavy use of VT100 control sequences and Unicode box-drawing characters.

As Pandoc supports many input formats:

(several dialects of) Markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, TikiWiki markup, Creole 1.0, Vimwiki markup, OPML, Emacs Org-Mode, Emacs Muse, txt2tags, Microsoft Word docx, LibreOffice ODT, EPUB, or Haddock markup

this writer is suitable for displaying any document in any of these input formats.

Usage

You need to have pandoc installed on your machine, and the terminal.lua script from this repository copied somewhere on your machine.

Then invoke the reader with

$ pandoc -t [path/to/]terminal.lua [the_document]

# e.g.:

$ pandoc -t terminal.lua README.md 

As word wrapping is not yet supported, you may want to pipe the output into the fold command. You may also want to use a pager such as less:

$ pandoc -t terminal.lua README.md | fold -s | less -r

Note that currently the word wrapping as implemented by fold will break the indentation and the code and quote blocks decorations. This is an issue we want to address inside the writer in the near future.

Demo

A screenshot is worth 1000 words:

This document :

Another Markdown document :

A LibreOffice text document

Author

Camille Oudot (© 2018 Orange)

Licence

This work is published under the MIT license

You can’t perform that action at this time.