Debian Codegraph @

docs/content/en/content-management/formats.md

raw
1 ---
2 title: Content formats
3 description: Create your content using Markdown, HTML, Emacs Org Mode, AsciiDoc, Pandoc, or reStructuredText.
4 categories: []
5 keywords: []
6 aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
7 ---
8
9 ## Introduction
10
11 You may mix content formats throughout your site. For example:
12
13 ```tree
14 content/
15 └── posts/
16 ├── post-1.md
17 ├── post-2.adoc
18 ├── post-3.org
19 ├── post-4.pandoc
20 ├── post-5.rst
21 └── post-6.html
22 ```
23
24 Regardless of content format, all content must have [front matter][], preferably including both `title` and `date`.
25
26 Hugo selects the content renderer based on the `markup` identifier in front matter, falling back to the file extension. See the [classification](#classification) table below for a list of markup identifiers and recognized file extensions.
27
28 ## Formats
29
30 ### Markdown
31
32 Create your content in [Markdown][] preceded by front matter.
33
34 Markdown is Hugo's default content format. Hugo natively renders Markdown to HTML using [Goldmark][]. Goldmark is fast and conforms to the [CommonMark][] and [GitHub Flavored Markdown][] specifications. You can configure Goldmark in your [project configuration][configure goldmark].
35
36 Hugo provides custom Markdown features including:
37
38 [Attributes][]
39 : Apply HTML attributes such as `class` and `id` to Markdown images and block elements including blockquotes, fenced code blocks, headings, horizontal rules, lists, paragraphs, and tables.
40
41 [Extensions][]
42 : Leverage the embedded Markdown extensions to create tables, definition lists, footnotes, task lists, inserted text, mark text, subscripts, superscripts, and more.
43
44 [Mathematics][]
45 : Include mathematical equations and expressions in Markdown using LaTeX markup.
46
47 [Render hooks][]
48 : Override the conversion of Markdown to HTML when rendering fenced code blocks, headings, images, and links. For example, render every standalone image as an HTML `figure` element.
49
50 ### HTML
51
52 Create your content in [HTML][] preceded by front matter. The content is typically what you would place within an HTML document's `body` or `main` element.
53
54 > [!NOTE]
55 > The HTML content format is denied by default. See [`security.allowContent`][].
56
57 ### Emacs Org Mode
58
59 Create your content in the [Emacs Org Mode][] format preceded by front matter. You can use Org Mode keywords for front matter. See [details][].
60
61 ### AsciiDoc
62
63 Create your content in the [AsciiDoc][] format preceded by front matter. Hugo renders AsciiDoc content to HTML using the Asciidoctor executable. You must install Asciidoctor and its dependencies (Ruby) to render the AsciiDoc content format.
64
65 You can configure the AsciiDoc renderer in your [project configuration][configure asciidoc].
66
67 In its default configuration, Hugo passes these CLI flags when calling the Asciidoctor executable:
68
69 ```sh
70 --no-header-footer
71 ```
72
73 The CLI flags passed to the Asciidoctor executable depend on configuration. You may inspect the flags when building your project:
74
75 ```sh
76 hugo build --logLevel info
77 ```
78
79 ### Pandoc
80
81 Create your content in the [Pandoc][] format preceded by front matter. Hugo renders Pandoc content to HTML using the Pandoc executable. You must install Pandoc to render the Pandoc content format.
82
83 Hugo passes these CLI flags when calling the Pandoc executable:
84
85 ```sh
86 --mathjax
87 ```
88
89 ### reStructuredText
90
91 Create your content in the [reStructuredText][] format preceded by front matter. Hugo renders reStructuredText content to HTML using [Docutils][], specifically rst2html. You must install Docutils and its dependencies (Python) to render the reStructuredText content format.
92
93 Hugo passes these CLI flags when calling the rst2html executable:
94
95 ```sh
96 --leave-comments --initial-header-level=2
97 ```
98
99 ## Classification
100
101 {{% include "/_common/content-format-table.md" %}}
102
103 When converting content to HTML, Hugo uses:
104
105 - Native renderers for Markdown, HTML, and Emacs Org mode
106 - External renderers for AsciiDoc, Pandoc, and reStructuredText
107
108 Native renderers are faster than external renderers.
109
110 [AsciiDoc]: https://asciidoc.org/
111 [Attributes]: /content-management/markdown-attributes/
112 [CommonMark]: https://spec.commonmark.org/current/
113 [Docutils]: https://docutils.sourceforge.io/
114 [Emacs Org Mode]: https://orgmode.org/
115 [Extensions]: /configuration/markup/#extensions
116 [GitHub Flavored Markdown]: https://github.github.com/gfm/
117 [Goldmark]: https://github.com/yuin/goldmark
118 [HTML]: https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started/Your_first_website/Creating_the_content
119 [Markdown]: https://daringfireball.net/projects/markdown/
120 [Mathematics]: /content-management/mathematics/
121 [Pandoc]: https://pandoc.org/MANUAL.html#pandocs-markdown
122 [Render hooks]: /render-hooks/introduction/
123 [`security.allowContent`]: /configuration/security/#allowcontent
124 [configure asciidoc]: /configuration/markup/#asciidoc
125 [configure goldmark]: /configuration/markup/#goldmark
126 [details]: /content-management/front-matter/#emacs-org-mode
127 [front matter]: /content-management/front-matter/
128 [reStructuredText]: https://docutils.sourceforge.io/rst.html