--recursive, Convert multiple local markdown documents
A way to render/watch/live multiple markdown documents would be nice. Ideally links to other local markdown documents should open them rendered, as they are in Github.
Watch and single mode:
The given solution would be an -r, --recursive flag, which converts all .md files in a directory and also rewrites local .md links. Aggregate a list of the paths to enable --watch to track them.
This would also necessitate codifying that <file>.md in converted into <file>.html (modifiable via -o?), so that link rewriting is predictably correct (if the linked .md existed to begin with).
Live mode:
The best way is probably unrelated to how watch and single mode are done, since the conversion of each file is isolated and the renaming predictable.
When the server gets a request for a path matching the conversion pattern (ends in .html) we:
- reverse the file renaming (
.html->.md), - open that original file (on failure, fallback to the serve_static_file for original requested path),
- convert,
- return with file change watching for that file.
(Upon consideration, link renaming should probably be its own command line flag. Probably -L. It would still be dependent on this to be meaningful.)