Back in 2015 I wrote a little utility called mdless for previewing Markdown files on the command line. It performs some basic formatting fix-up, and then highlights the various elements of a Markdown document, paging it out in your terminal. While it’s been popular via Hacker News and StackOverflow posts, I hadn’t really updated it much since the release.
When I finally got around to responding to some GitHub issues on it, I decided to go a little beyond the bugfixes to polish and extend it a bit. The bugfixes include errors on syntax highlighting, overruns on long blocks, you know, stuff like that.
I’d been doing point releases from 0.0.1 to 0.0.15, but I’ve decided it’s at a 1.0 place. So join me in welcoming mdless 1.0.0. Cheers. (It’s actually 1.0.2 already, because bugs. You know how it is.) It’s honestly not that huge a release, but it does breathe new life into the aging utility.
As a reminder (or introduction), here’s a list of the main features:
- Built in pager functionality with pipe capability, a
lessreplacement for Markdown files
- Tidy and highlight (Multi)Markdown table syntax
- Colorize Markdown syntax for most elements
- Normalize spacing and link formatting
- Display footnotes after each paragraph
- Inline image display (local, optionally remote) if using iTerm2 2.9+
- Syntax highlighting when Pygments is installed
- List headlines in document, display single section of the document structure based on headlines
- mdless now does more and better Markdown highlighting
- it picks apart a few syntaxes into more finite bits for colorization
- Better formatting and highlighting of (Multi)Markdown tables
- rewritten colorization code, which is generally of more benefit to me than you
- Improved syntax highlighting for code blocks
- Only fenced code with a language defined (e.g. “```python”) will be highlighted
- Prettier code blocks even if Pygments isn’t installed
- Better language detection on fenced code blocks. Recognizes slightly malformed syntax and does a solid job of detecting language from any hashbang in the code
- A blackout feature for adding a background color to blocks, even if they’re syntax highlighted
- Totally user-customizable
- Control every color for every element
- Determine how different header levels are highlighted
- Set a custom theme for Pygments highlighting
It’s still not perfect, but for getting a prettier view than
cat when you want to peruse Markdown files in Terminal, it’s pretty top notch. In my opinion, anyway.
All of the documentation is updated, along with installation instructions, on the mdless project page.