If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Pandoc can convert between the following formats:
Convert a Single Markdown File to AsciiDoc. Given that I only need three options, here’s an example of the command that I’d run to convert a Markdown file to AsciiDoc (formatted for readability): kramdoc -format=GFM -output=getting-started.adoc -wrap=ventilate getting-started.md. This guide provides a gentle introduction to AsciiDoc, a plain text documentation syntax and processor.This introduction is intended for anyone who wants to reduce the effort required to write and publish content, whether for technical documentation, articles, web pages or good ol'-fashioned prose. It follows the same syntax as regular Markdown code blocks, with ways to tell the highlighter what language to use for the code block. The language will be detected automatically, if possible. Or you can specify it on the first line with 3 colons and the language name.
(← = conversion from; → = conversion to; ↔︎ = conversion from and to)
↔︎ Markdown (including CommonMark and GitHub-flavored Markdown)
↔︎ reStructuredText
→ AsciiDoc
↔︎ Emacs Org-Mode
↔︎ Emacs Muse
↔︎ Textile
← txt2tags
↔︎ (X)HTML 4
↔︎ HTML5
↔︎ EPUB version 2 or 3
↔︎ FictionBook2
→ GNU TexInfo
↔︎ Haddock markup
↔︎ roff man
→ roff ms
↔︎ LaTeX
→ ConTeXt
↔︎ DocBook version 4 or 5
↔︎ JATS
→ TEI Simple
↔︎ OPML
↔︎ BibTeX
↔︎ BibLaTeX
↔︎ CSL JSON
↔︎ CSL YAML
↔︎ Microsoft Word docx
↔︎ OpenOffice/LibreOffice ODT
→ OpenDocument XML
→ Microsoft PowerPoint
↔︎ Jupyter notebook (ipynb)
→ InDesign ICML
↔︎ MediaWiki markup
↔︎ DokuWiki markup
← TikiWiki markup
← TWiki markup
← Vimwiki markup
→ XWiki markup
→ ZimWiki markup
↔︎ Jira wiki markup
→ LaTeX Beamer
→ Slidy
→ reveal.js
→ Slideous
→ S5
→ DZSlides
← CSV tables
Adoc Markdown Table
→ custom writers can be written in lua.
→ via pdflatex
, lualatex
, xelatex
, latexmk
, tectonic
, wkhtmltopdf
, weasyprint
, prince
, context
, or pdfroff
.
Pandoc understands a number of useful markdown syntax extensions, including document metadata (title, author, date); footnotes; tables; definition lists; superscript and subscript; strikeout; enhanced ordered lists (start number and numbering style are significant); running example lists; delimited code blocks with syntax highlighting; smart quotes, dashes, and ellipses; markdown inside HTML blocks; and inline LaTeX. If strict markdown compatibility is desired, all of these extensions can be turned off.
LaTeX math (and even macros) can be used in markdown documents. Several different methods of rendering math in HTML are provided, including MathJax and translation to MathML. Ppsspp naruto games for android free download. LaTeX math is converted (as needed by the output format) to unicode, native Word equation objects, MathML, or roff eqn.
Pandoc includes a powerful system for automatic citations and bibliographies. This means that you can write a citation like
and pandoc will convert it into a properly formatted citation using any of hundreds of CSL styles (including footnote styles, numerical styles, and author-date styles), and add a properly formatted bibliography at the end of the document. The bibliographic data may be in BibTeX, BibLaTeX, CSL JSON, or CSL YAML format. Citations work in every output format.
There are many ways to customize pandoc to fit your needs, including a template system and a powerful system for writing filters.
Pandoc includes a Haskell library and a standalone command-line program. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.
Pandoc is free software, released under the GPL. Copyright 2006–2020 John MacFarlane.
You can put any file type into your /content
directories, but Hugo uses the markup
front matter value if set or the file extension (see Markup identifiers
in the table below) to determine if the markup needs to be processed, e.g.:
- Markdown converted to HTML
- Shortcodes processed
- Layout applied
List of content formats
The current list of content formats in Hugo:
Name | Markup identifiers | Comment |
---|---|---|
Goldmark | md, markdown, goldmark | Note that you can set the default handler of md and markdown to something else, see Configure Markup. |
Blackfriday | blackfriday | Blackfriday will eventually be deprecated. |
MMark | mmark | Mmark is deprecated and will be removed in a future release. |
Emacs Org-Mode | org | See go-org. |
AsciiDoc | asciidocext, adoc, ad | Needs Asciidoctor installed. |
RST | rst | Needs RST installed. |
Pandoc | pandoc, pdc | Needs Pandoc installed. |
HTML | html, htm | To be treated as a content file, with layout, shortcodes etc., it must have front matter. If not, it will be copied as-is. |
The markup identifier
is fetched from either the markup
variable in front matter or from the file extension. For markup-related configuration, see Configure Markup.
External Helpers
Some of the formats in the table above need external helpers installed on your PC. For example, for AsciiDoc files,Hugo will try to call the asciidoctor
command. This means that you will have to install the associatedtool on your machine to be able to use these formats.
Hugo passes reasonable default arguments to these external helpers by default:
asciidoctor
:--no-header-footer -
rst2html
:--leave-comments --initial-header-level=2
pandoc
:--mathjax
Because additional formats are external commands, generation performance will rely heavily on the performance of the external tool you are using. As this feature is still in its infancy, feedback is welcome.
External Helper AsciiDoc
AsciiDoc implementation EOLs in Jan 2020 and is no longer supported.AsciiDoc development is being continued under Asciidoctor. The format AsciiDocremains of course. Please continue with the implementation Asciidoctor.
External Helper Asciidoctor
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.See the Asciidoctor docs for installation instructions. Make sure that also alloptional extensions like asciidoctor-diagram
or asciidoctor-html5s
are installed if required.
External asciidoctor
command requires Hugo rendering to disk to a specific destination directory. It is required to run Hugo with the command option --destination
.
Some Asciidoctor parameters can be customized in Hugo:
Parameter | Comment |
---|---|
backend | Don’t change this unless you know what you are doing. |
doctype | Currently, the only document type supported in Hugo is article . |
extensions | Possible extensions are asciidoctor-html5s , asciidoctor-bibtex , asciidoctor-diagram , asciidoctor-interdoc-reftext , asciidoctor-katex , asciidoctor-latex , asciidoctor-mathematical , asciidoctor-question , asciidoctor-rouge . |
attributes | Variables to be referenced in your AsciiDoc file. This is a list of variable name/value maps. See Asciidoctor’s attributes. |
noHeaderOrFooter | Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. Don’t change this unless you know what you are doing. |
safeMode | Safe mode level unsafe , safe , server or secure . Don’t change this unless you know what you are doing. |
sectionNumbers | Auto-number section titles. |
verbose | Verbosely print processing information and configuration file checks to stderr. |
trace | Include backtrace information on errors. |
failureLevel | The minimum logging level that triggers a non-zero exit code (failure). |
Hugo provides additional settings that don’t map directly to Asciidoctor’s CLI options:
- workingFolderCurrent
- Sets the working directory to be the same as that of the AsciiDoc file being processed, so that include will work with relative paths. This setting uses the
asciidoctor
cli parameter--base-dir
and attributeoutdir=
. For rendering diagrams with asciidoctor-diagram,workingFolderCurrent
must be set totrue
. - preserveTOC
- By default, Hugo removes the table of contents generated by Asciidoctor and provides it through the built-in variable
.TableOfContents
to enable further customization and better integration with the various Hugo themes. This option can be set totrue
to preserve Asciidoctor’s TOC in the generated page.
Below are all the AsciiDoc related settings in Hugo with their default values:
Notice that for security concerns only extensions that do not have path separators (either ,
/
or .
) are allowed. That means that extensions can only be invoked if they are in one’s ruby’s $LOAD_PATH
(ie. most likely, the extension has been installed by the user). Any extension declared relative to the website’s path will not be accepted.
Example of how to set extensions and attributes:
Adoc Markdown Code
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with allparameters. Run Hugo with -v
. You will get an output like
Learn Markdown
Markdown syntax is simple enough to learn in a single sitting. The following are excellent resources to get you up and running: