This script could be automatically injected before .md files using the nginx directive add_before_body. An instant static site of markdown files with no preprocessing step.
location ~* /markdown/.*\.md$ {
add_before_body "/markdown/header.html";
types {}
default_type text/html;
}
And a little bit of CSS to keep the line breaks if the JS is disabled: <!DOCTYPE html><script src="https://cdn.jsdelivr.net/npm/texme@0.7.0"></script>
<style>body > main { white-space: normal; }</style>
<body style="white-space: pre-line;">