cmcat

cmcat logo

Description

A fast, distraction free CommonMark (markdown) previewer for kitty or other terminal emulators. It is fast, lightweight and not using Electron or any other browser engine. It is TUI based and written in pure Python with no other dependencies.

cmcat v0.24 running in kitty under Linux
cmcat v0.2 running in cmd.exe

If you enjoy editing CommonMark (a Markdown standard) and using the terminal for productive tasks, then cmcat is for you. If you have an older computer and rendering and previewing Markdown (e.g. in Visual Studio Code) is eating up lots of CPU power, then cmcat is for you.

With cmcat, you can have a CommonMark preview sitting next to your editor and check the changes in realtime. You do not have to install multiple external libraries. You can use cmcat without further dependencies. To preview images, either use kitty or install chafa image viewer.

If you want to preview not only plain CommonMark but different sized headings and images in your terminal, then cmcat is for you. It is highly configurable, non-distractive, showing a table of contents by default, bookmarks and is saving the last position before closing a document. In fact, you can even use it to read an entire book or a huge documentation.

To overcome the limitations of different font sizes and displaying images, kitty is the best option. However, cmcat is also very useful in other terminal emulators. Note that in this case, fonts and images are somewhat jagged.

Download

Bug Report and suggestions

Send a description of the bug or the suggestion to: klangwerkbank@solnet.ch
Include DEBUG.log created by cmcat --debug=DEBUG.log <file.md> if possibly useful for debugging together with a description in how to produce the error.

Markdown Support

The following markdown syntax and file-formats can be used for cmcat:

What ✔/✘ Description
CommonMark Syntax ✓✓✓ as specified in the CommonMark Spec.
raw html ✓✓ restricted support: a browser can show raw html, directly. A terminal cannot. See cmcat.pdf for detailed description.
images preview ✓✓1 JPEG, PNG and SVG (with some restrictions) are supported.
images preview ✗ GIF, WebP, TIFF, AVIF and others.
image-captions ✓✓✓ An image that stands alone in its paragraph gets its alt text as a caption below it.
image without caption ✓✓✓ An image within text get no caption.
remote images ✓✓✓ Remote images (https://…) are not loaded by default for security. Edit ~/.config/theme.md to enable it or use option --remote-images
different font sizes ✓✓2 Headings h1…h6 are supported.

Useful supported extensions:

What ✔/✘ Description
YAML (front matter) ✓✓✓ supported, but hidden by default. Shown with a colored bar.
Callouts (::: :::) ✓✓✓ are shown with a colored bar.
Tables ✓✓✓ supported as mentioned here: https://pandoc.org/demo/example33/8.9-tables.html
Footnotes ✓✓✓ supported as mentioned here: https://pandoc.org/demo/example33/8.19-footnotes.html#footnotes
Links ✓✓✓ are terminal hyperlinks (OSC 8). Open them with the link click of your terminal (kitty: Ctrl+Shift+click, other terminals: Ctrl+click)

FAQ


  1. Use kitty for best experience. If you are using xterm or similar, images can be previewed with chafa image viewer.↩︎

  2. Use kitty for best experience. If you are using xterm or similar, fonts are quite jagged looking.↩︎