This does two things:
- Monitor a markdown file using fsnotify, convert it to HTML on save using goldmark and bluemonday (to sanitize the HTML), and display/update the display in a web browser at http://localhost:5052/content; or
- Convert a markdown file to an HTML file using the above tools.
❯ ./mdp -infile README.md
Server listening on http://localhost:5052/content
After this, the preview should open in a new browser tab and auto-update each time the file is saved.
❯ ./mdp -infile README.md -outfile readme.html
- If using brew:
brew update
andbrew install go
(orbrew update go
to get go 1.19) - Without brew, see directions at https://go.dev/doc/install
git clone https://github.com/scottbarnes/mdp.git
cd mdp
go build
- Run with
./mdp -infile <filename.md>
❯ ./mdp -h
-infile string
Markdown file to preview
-outfile string
Optional output HTML file
-t string
Alternate template name