Zigdown: Markdown Toolset

Hello, Zig friends!

Today I’m excited relieved to release v1.0 of my long-running Markdown project, Zigdown. I’ve been working on this off and on for a few years now, and it’s reached a point where I’m ready to tie a bow on it and call it mostly done :slight_smile:

Prebuilt binaries are available from the Releases link on Github.

Capabilities

See the README for more details (and feel free to reach out if you have any questions), but the main features are:

  • Pure Zig Markdown parser (no external C libraries required - although TreeSitter is used to provide syntax highlighting of within blocks)
  • In-terminal Markdown viewer (including image rendering)
  • In-terminal slideshow presentation tool
  • Neovim Markdown preview pane and auto-formatter
  • Markdown to HTML renderer
  • Documentation server

Zigdown powers my personal website, and at work, I use it on a nearly daily basis to review documentation. Because the parser was written from scratch in Zig, I’ve found it fairly easy to add new Markdown extensions such as alert boxes. AFAIK, all the other Zig projects which parse Markdown use a 3rd-party parser library such as cmark or cmark-gfm.

I hope others might find Zigdown useful! If you’re looking for a more “professional” static site generator, you’re probably better off using Zine; and if you need full CommonMark compliance, you’re better off using cmark; but if you want to play around with a pure-Zig Markdown parser with some fun capabilities, maybe this is for you! Just note that you will undoubtedly encounter bugs in parsing, rendering, or both; I’ll continue fixing any I find, though. And with that, I can finally move on to my next project :joy:

In-Terminal Presentation Demo:

https://asciinema.org/a/730075

36 Likes

The fact that it can render markdown in the terminal is great. I might consider using it for presentations in future.

An alternative use-case might be to browse through markdown files in the terminal. I use Obsidian and other markdown based tools all the time. It would be awesome to be able to view markdown files and even follow links in the terminal.

3 Likes

@_sh that’s a good idea; I’m planning to add table-of-contents generation to the HTML renderer based on the contents of a directory, so it should be possible to do the same thing in the terminal. My terminal output code wasn’t really designed for full interactive TUI’s, though, so making it “nice” might be hard. However, a “ToC Slide” that shows “slide numbers” for all the documents in a directory, then allows you to type a slide number to jump to, should be pretty simple!

FWIW you can kinda do this now using the present command with the -r (recursive) option, you just won’t get a table of contents.

2 Likes

Thank you so much for this! I’ve been wanting a cli markdown renderer that’s minimal in dependencies and written in a systems language. I’ll package this in the AUR unless someone else does that first :slight_smile:

2 Likes

that’s amazing and so beautiful! just last week I searched for good markdown terminal renderer/presentation tool
great timing :slight_smile:

1 Like

Glad you like it!

That would be neat! I’ve specifically focused on keeping fully-static builds available, so “packaging” it should be easy :slightly_smiling_face: