My favorite editor is vim, but it has downsides as well. Vim doesn’t have a the GUI needed to extend it to preview things like Markdown properly. Yeah, sure vim can highlight Markdown syntax, but that is not a replacement for real previewing. With that itch in mind, I searched for a solution but found none that satisfied me. For reStructuredText I’ve found a solution that worked well. It worded by starting a local web-server and does the previewing in the browser. Inspired by it, I started writing
mdview allows you to instantly preview in your favorite browser any Markdown file you’re editing. It will automatically refresh when the file is changed, hence it great for working with the editor and browser side-by-side for live preview.
mdview‘s Markdown support is based on
python-markdown which means it supports all kinds of Markdown flavors including Markdown Extra (which means among other things GitHub style fenced code blocks and footnotes) and syntax highlighting for many languages based on Pygments. The web server itself is based on Flask.
While I had Vim in mind when I wrote it,
mdview is actually editor agnostic and should work great with any editor.
mdview is available from PyPI so you can install it using
# pip install mdview
mdview and pass it the Markdown file you want to preview.
mdview will automatically open a browser window displaying the rendered file. For example:
$ mdview Readme.md
You can enable
python-markdown extensions by using the
This is only an early release. My future plans for
mdview including the ability to serve an entire directory (which would allow sort of “wiki” like experience) and adding MathJax support to display formulas easily.
One thought on “Introducing
mdview– a lightweight Markdown viewer”
especially seeing that Firefox Quantum Markdown Viewer has problems
with Linux, this is a real alternativ for me!