Kramdown ANSI - Output markdown with ANSI
Description
Kramdown::ANSI: A library for rendering Markdown(ish) documents with beautiful
ANSI escape sequences in the terminal.
Installation (gem & bundler)
To install Kramdown::ANSI, you can use the following methods:
- Type
gem install kramdown-ansi
in your terminal.
- Or add the line
gem 'kramdown-ansi'
to your Gemfile and run bundle install
in your terminal.
Usage
In your own software the library can be used as shown in this example:
require 'kramdown/ansi' puts Kramdown::ANSI.parse(markdown)
Executables
Method | Description |
---|---|
md executable |
Outputs Markdown files with ANSI escape sequences in the terminal |
git-md executable |
A Git plugin that outputs Markdown formatted git commit messages into the terminal |
The md executable
The md
executable can by used with file arguments:
md Foo.md Bar.md …
or as a unix filter:
cat Foo.md Bar.md | md
It outputs the markdown files with ANSI escape sequences in the terminal. If
the file has more lines than the current terminal window has, it attempts to
open a pager command like less
or more
and pipes its output into it.
By setting the PAGER
environment variable accordingly one can define a custom
command for this purpose.
The output of the md
command can be seen in this screenshot:
The git-md executable
The git-md
executable is a git plugin that can be used to output markdown
formatted git commit messages (just like git log
) into the terminal using
git md
You can pass arguments to it like you would of git log
, e.g.
git md -p
to show the patches additionally to the log messages.
By setting the GIT_PAGER
or PAGER
environment variable accordingly one can
define a custom command for this purpose as well, unless a different
pager command was defined setting git config set core.pager FOO
, in which
case the FOO command is used as a pager for all git commands including git
.
md
The output of the git md
command can be seen in this screenshot:
Download
The homepage of this library is located at
Author
Kramdown ANSI was written by Florian Frank Florian Frank
License
This software is licensed under the MIT license.
Mandatory Kitten Image
This is the end.