2 ms·
I'll jump on this bandwagon too. I did it in Rust, because I wanted to learn Rust. It just takes a directory structure with markdown files, and converts each
by Shared404 5y ago
I'll jump on this bandwagon too.
I did it in Rust, because I wanted to learn Rust.
It just takes a directory structure with markdown files, and converts each file to HTML while adding a header and footer. I use it on a few sites now, and honestly I should redo the code but it works conveniently and I have other stuff to do.
Oh, and my stack is nginx on Alpine currently.
Edit:
Code is here: https://git.sr.ht/~evan-hoose/SSSSS https://git.sr.ht/~evan-hoose/SSSSS
It really is not great code. It even shells out to markdown to do the rendering - bad for all sorts of obvious reasons. (but the right choice for my use case).
If you want to use it, be my guest. Just know that it's bad and ugly and you could write it better yourself in not very long.
- qchris 5y agoJumping on the bandwagon of the guy that jumped on the bandwagon, because you mentioned potentially re-doing your own code at some point so might be interested: my personal site [0] looks very much like this (and is also written in Rust), but uses the comrak [1] crate to convert blog posts from Markdown to HTML on the fly before formatting with the header/footer theme. Using comrak lets you write in-line HTML (so you're not stuck with only Markdown syntax if you want to do something fancier like code blocks or <math></math>), and the whole site ends up <150 LoC, including route definitions. It handled the one potential HN hug-of-death event I've had without issues while running on the smallest DO droplet offered, and has basically been issue-free since I got it up and running. [0] https://github.com/quietlychris/site https://github.com/quietlychris/site [1] https://github.com/kivikakk/comrak https://github.com/kivikakk/comrak
- Shared404 5y agoLooks interesting, thanks! I may very well do something similar at some point, though I've also thought about using it as an excuse to redo whenever I want to learn $LANGUAGE, or writing a markdown (or subset of markdown) interpreter at some point. Definitely going to read through the code more closely as well - I've been meaning to find some short and well written Rust.