Markdown logo with text that reads, Markdown Viewers.

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.

Bat

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.

Screenshot of the Bat rendering a Markdown document within the Kitty terminal.

  • Project: GitHub
  • Tested version: 0.22.1

Glow

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.

Screenshot of the Glow rendering a Markdown document within the Kitty terminal.

  • Project: GitHub
  • Tested version: 1.4.1

Mdcat

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 -p.

Screenshot of the mdcat rendering a Markdown document within the Kitty terminal.

  • Project: GitHub
  • Tested version: 0.30.1

Closing Thoughts

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. The only area I noticed that was somewhat disappointing is that none of the viewers supported rendering tables. I couldn’t confirm this for Bat, and Glow, but mdcat only supports CommonMark and therefore does not support tables.

What are your thoughts? Did I miss a viewer I should have included? Let’s continue the discussion by contact me.

This is post 61 of 100, and is round 2 of the 100 Days To Offload challenge.

    • change topic
    • change 100DaysToOffload message