Git Product home page Git Product logo

pandoc-terminal-writer's Introduction

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.

This writer tries to adapt automatically the maximal width of some elements (like table or blockquotes). If you want to narrow those elements, you can export the "COLUMNS" environment variable with the terminal width of you choice:

$ COLUMNS=80 pandoc -t terminal.lua README.md | less -r

Demo

A screenshot is worth 1000 words:

This document :

Current README.md

Another Markdown document :

the showcase.md test document

A LibreOffice text document

LibreOffice and terminal rendered document

Authors

© 2018 — 2020 Orange

Camille Oudot

Benoît Bailleux

Licence

This work is published under the MIT license

pandoc-terminal-writer's People

Contributors

bbailleux avatar camilleoudot avatar lou1306 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.