Publishing markdown to html uses a default pandoc template.
See the contents of the default template with:
pandoc --print-default-template=html
Dump the default template to a file:
pandoc --print-default-template=html > my_template.html
Make changes to the template. Then:
pandoc -f markdown -t html --standalone --template=my_template.html myfile.md
Use the pandoc line_blocks
extension to preserve leading whitespace when exporting markdown to html.
Write markdown with a pipe prefix, e.g.
| hello
| world
The leading pipe needs to be in the first column of markdown.
https://pandoc.org/MANUAL.html#extension-line_blocks
pandoc --list-extension=markdown
Use the export option autolink_bare-uris
, e.g.
pandoc -f markdown+autolink_bare_uris -t html --standalone myfile.md
Use to enter two spaces at the end of a line of markdown.
This creates a newline in the exported html.
Good for preserving newlines in html exported with pandoc.
nnoremap <leader>n $A <Esc>j0
https://pandoc.org/MANUAL.html#block-content-in-list-items
Install pandoc:
brew install pandoc
Then from vim in a markdown file, use:
:! pandoc -f markdown -t html --standalone % > %.html && open %.html