Markdown preview written in Rust

About a year or so ago I've switched to self-made python script to preview markdown file in browser (this commit introduced it in my own dotfiles repository).

It was using pandoc under the hood to convert markdown to html. Well, it was not optimal, probably, but it worked.

I've started to read Rust documentation recently and decided to (re)implement markdown preview in Rust.

The most valuable thing I saw in this was the fact that it will be single binary to use - no third-party dependencies would be needed to install.

So, here is the code - markdown preview written in Rust.

This is my first project written in Rust and it is definitely not as idiomatic as it should be and has no tests at the moment but it works as expected. Yay.

Under the hood mdpreview uses following Rust libraries:

  • clap - to process command-line arguments,
  • pulldown-cmark - to convert markdown to html,
  • hyper and tokio - web server to serve generated html.

Some ideas for the code I've got looking through sources of zola.

Ownership is a new concept to me and I'm still not sure I'm getting it right but Rust is definitely worth trying. Here is the list of resources I'm using to study Rust (just for the record):

That's it for the mdpreview intro, let's move on and (re)implement in Rust something else. Stay tuned.

Last modified: 2020-05-05 07:38:00 +00:00 UTC