cmcat
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.
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
- cmcat.pdf – documentation
- CMcat_v0.26.zip) – v0.26
- CMcat_v0.25.zip) – v0.25
- CMcat_v0.24.zip) – v0.24 (first published version)
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
-
Q: Why CommonMark?
A: It attempts to specify Markdown syntax by John Gruber unambiguously. -
Q: How do I learn writing in CommonMark?
A: It’s not that hard. Refer to https://commonmark.org/help -
Q: Where is the specification of CommonMark?
A: At https://spec.commonmark.org/current -
Q: Why is raw HTML supported?
A: It is included in CommonMark. Rather than using a gazillion ways to form a table in markdown, it is better to use html-tags. Despite that it is working quite fine, consider that it is cryptic for readers.
To overcome this, cmcat is supporting lots of different table-formats as well. -
Q: Is it generating a warning if the document is not following the CommonMark specs?
A: No, cmcat is doing it’s best to show other markdown flavours as well. Use markdown-cli to be strict with your document. -
Q: Why was cmcat developed using Claude Chat AI?
A: I had a clear vision in mind for some years. Using Claude Chat, I was able to develop it within weeks without dependencies of other libraries. Honestly – I couldn’t have done it alone. -
Q: Why another TUI interface?
A: I like using the terminal for nondistractive and productive tasks every single day. Do you? -
Q: Why cmcat cannot be used as an editor?
A: There are already too much editors out there. Too much. Really! -
Q: Is cmcat for authors?
A: Yes, this was my real intention while writing an ebook. However, it can be used for manyfold purposes. -
Q: Why use a sidebar showing table of contents?
A: If you ever have written a huge documentation, you know why. Navigation is important to find a specific topic. -
Q: I do not like the colors in cmcat.
A: This is not a question. -
Q: How do I configure colors, then?
A: Edit~/.config/cmcat/theme.mdto your gusto. -
Q: Is cmcat working under Windows?
A: Yes, in the same manner as it does in xterm. But: rather start using GNU/Linux today. -
Q: How can I scroll in cmcat? There is no scrollbar!
A: You can use UP/DWN, PGUP/PGDWN to scroll or use the mousewheel. To navigate in huge documents, rather use the table of contents in the sidebar or bookmarks.
-
Use kitty for best experience. If you are using xterm or similar, images can be previewed with chafa image viewer.↩︎
-
Use kitty for best experience. If you are using xterm or similar, fonts are quite jagged looking.↩︎