Markdown Viewers for the Linux Command Line
- Adam Douglas
Though Markdown files are text based, at times it would be handy to have syntax highlighting or rendering of the document for ease of reading in the Linux terminal. Viewers usually solve this by providing a simple, light weight and fast user experience. Let’s find out what these solutions have to offer.
The software application here is not directly intended as a markdown viewer, but rather as cat clone with syntax highlighting and Git integration. However, it does work quite well. The project is primarily written in Rust and describes Bat as “A cat clone with wings”. When launching the application, you are presented with a nice clean interface, with filename at the top and a column on the left showing the line numbers, and on the right the document content. Syntax highlighting is definitely Bat’s strong suite with over 166 supported language as of this post. On top of that when viewing files there are indicators shown beside the line numbers which lines have been altered according to the git index. Another nice feature of this viewer is the fact that it can be told to show non-printable characters, which is always handy when trying to locate that problem character. The pager used is less by default, but can be changed to the desired command. One last feature that I have to say can be nice to use, is the ability to view multiple files at once. Each file is shown in the viewer one after another. I would suggest looking at the command line help, as there is quite a lot that can be done.
- Project: GitHub
- License: Apache-2.0, MIT
- Tested version: 0.23.0
This colorful Go language based viewer is definitely the one with the most pizzazz as the project describes it. It works directly from the command line, but also provides a text user interface (TUI) with optional mouse support. To use TUI-mode simply run the command without providing a filename and once loaded all the markdown files are shown in a list for ease of browsing. The app can be configured to set styles (dark, light, auto), show local files only (TUI-mode only), mouse support (TUI-mode only), pager, word-wrap width. An added feature called stash provides the ability to store markdown files into your own private encrypted collection. To top this all off the viewer also is able to edit local files and copy file contents.
A Rust based browserless markdown viewer powered by the GPU (graphics processing unit) that doesn’t require the use of Electron or Chrome. This slim viewer handles basic HTML rendering with the power of detecting live file modifications along with optional mouse support and clickable links. A handy feature to use alongside your favorite text editor. Presently Inlyne supports tables, sizable images, code blocks, lists, check/task lists, links, hidden details, alignment of text/image, quote blocks, and text styles (bold, italics, underline, small). If you want something fast with basic support this viewer maybe for you.
Command line application mdcat is refereed to as a fancy cat for Markdown and is intended to be used with
Kitty or iTerm2 terminals with a good font that has
italic characters. When opening a document the rendering shows the title at the top with modified front matter and then
the body. Code blocks have syntax highlighting using syntect. Links within the
document a rendered nicely hiding the link address and making the link clickable to view. If images are present they
will be loaded inline in supported terminals only. One observation I noticed is, the viewer by default does not use a
pager. The pager though can be enabled with the parameter
There were a few areas that I was disappointed in, mdcat doesn’t support rendering tables, not all viewers have the ability to search within a document, Frogmouth opens up the last viewed document and Frogmouth doesn’t allow for disabling the history feature. Overall I feel each viewer has its strong points and anyone of them could easily do the job. It really comes down to an individual of what is preferred, and how it can all work together in one’s workflow.
This is post 61 of 100, and is round 2 of the 100 Days To Offload challenge.
- Bat project, GitHub
- Frogmouth project, GitHub
- Glow project, GitHub
- Markdown logo, image by Dustin Curtis, Wikimedia Commons
- Markdown, Wikipedia
- mdcat project, GitHub
- change topic
- change 100DaysToOffload message
- add viewer inlyne
- add new glow features
- change bat version
- change mdcat version
- add viewer frogmouth
- add software license
- change glow version
- change last paragraph