Pandoc is a commandline tool written in Haskell that can convert between different markup formats. For example, I write the pages of this blog in Markdown and convert them to HTML pages using Pandoc.
For detailed information about Pandoc commandline options please see man pandoc
or the online manual.
$ pandoc in.markdown -o out.html
--from
:$ pandoc --from=markdown in.markdown -o out.html
--to
:$ pandoc --to=html5 in.markdown -o out.html
--shift-heading-level-by
option:$ pandoc --shift-heading-level-by=1 in.markdown -o out.html
--title-prefix
option:$ pandoc --title-prefix="Foobar" in.markdown -o out.html
This makes the title of the page as Foobar -- Actual title
.
--template
option:$ pandoc --template=foobar.template in.markdown -o out.html
There is a default output template that is used for each output format and can be seen by using the --print-default-template
option. This default template can be used as a starting point to create your own templates.
--variable
option:$ pandoc --variable="date:2015-Jan-23" --template=foobar.template in.markdown -o out.html
We are specifying a variable of name date
and value 2015-Jan-23
here.
--css
option:$ pandoc --css=foobar.css in.markdown -o out.html
--include-in-header
option:$ pandoc --include-in-header=header.txt in.markdown -o out.html
I find this useful for including the analytics JS code in the HTML header for example.
--include-before-body
option:$ pandoc --include-before-body=header.html in.markdown -o out.html
--include-after-body
option:$ pandoc --include-after-body=header.markdown in.markdown -o out.html
+EXTENSIONNAME
or -EXTENSIONNAME
to the input format (--from
) or output format (--to
). For example, to enable two extensions on the input Markdown:$ pandoc --from=markdown+gfm_auto_identifiers+autolink_bare_uris in.markdown -o out.html
Information on the extensions can be found in the Pandoc manual.
Tried with: Pandoc 2.9.2.1 and Ubuntu 22.04