Home


2023

(pandoc, print default template)

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   

(pandoc, preserve leading whitespace, export html)

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 all markdown extensions)

pandoc --list-extension=markdown

Use the export option autolink_bare-uris, e.g. 

pandoc -f markdown+autolink_bare_uris -t html --standalone myfile.md  

(pandoc, markdown, newline, export, pandoc, html, vim)

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  

(pandoc, bookmark, indentation inside list items)

https://pandoc.org/MANUAL.html#block-content-in-list-items

2022

(pandoc, markdown viewer)

Install pandoc:

brew install pandoc  

Then from vim in a markdown file, use:

:! pandoc -f markdown -t html --standalone % > %.html && open %.html