hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

formats.md (8411B)

    1 ---
    2 title: Content Formats
    3 linktitle: Content Formats
    4 description: Both HTML and Markdown are supported content formats.
    5 date: 2017-01-10
    6 publishdate: 2017-01-10
    7 categories: [content management]
    8 keywords: [markdown,asciidoc,pandoc,content format]
    9 menu:
   10   docs:
   11     parent: "content-management"
   12     weight: 20
   13 weight: 20	#rem
   14 draft: false
   15 aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
   16 toc: true
   17 ---
   18 
   19 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.:
   20 
   21 * Markdown converted to HTML
   22 * [Shortcodes](/content-management/shortcodes/) processed
   23 * Layout applied
   24 
   25 ## List of content formats
   26 
   27 The current list of content formats in Hugo:
   28 
   29 | Name  | Markup identifiers | Comment |
   30 | ------------- | ------------- |-------------|
   31 | Goldmark  | md, markdown, goldmark  |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).{{< new-in "0.60.0" >}} |
   32 |Emacs Org-Mode|org|See [go-org](https://github.com/niklasfasching/go-org).|
   33 |AsciiDoc|asciidocext, adoc, ad|Needs [Asciidoctor][ascii] installed.|
   34 |RST|rst|Needs [RST](https://docutils.sourceforge.io/rst.html) installed.|
   35 |Pandoc|pandoc, pdc|Needs [Pandoc](https://www.pandoc.org/) installed.|
   36 |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.|
   37 
   38 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](/getting-started/configuration-markup/).
   39 
   40 ## External Helpers
   41 
   42 Some of the formats in the table above need external helpers installed on your PC. For example, for AsciiDoc files,
   43 Hugo will try to call the `asciidoctor` command. This means that you will have to install the associated
   44 tool on your machine to be able to use these formats.
   45 
   46 Hugo passes reasonable default arguments to these external helpers by default:
   47 
   48 - `asciidoctor`: `--no-header-footer -`
   49 - `rst2html`: `--leave-comments --initial-header-level=2`
   50 - `pandoc`: `--mathjax`
   51 
   52 {{% warning "Performance of External Helpers" %}}
   53 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.
   54 {{% /warning %}}
   55 
   56 ### External Helper AsciiDoc
   57 
   58 [AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported. 
   59 AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc 
   60 remains of course. Please continue with the implementation Asciidoctor.
   61 
   62 ### External Helper Asciidoctor
   63 
   64 The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo. 
   65 [See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/). Make sure that also all
   66 optional extensions like `asciidoctor-diagram` or `asciidoctor-html5s` are installed if required.
   67 
   68 {{% note %}}
   69 External `asciidoctor` command requires Hugo rendering to _disk_ to a specific destination directory. It is required to run Hugo with the command option `--destination`.
   70 {{% /note %}}
   71 
   72 Some [Asciidoctor](https://asciidoctor.org/man/asciidoctor/) parameters can be customized in Hugo:
   73 
   74 Parameter | Comment
   75 --- | ---
   76 backend | Don't change this unless you know what you are doing.
   77 doctype | Currently, the only document type supported in Hugo is `article`.
   78 extensions | Possible extensions are `asciidoctor-html5s`, `asciidoctor-bibtex`, `asciidoctor-diagram`, `asciidoctor-interdoc-reftext`, `asciidoctor-katex`, `asciidoctor-latex`, `asciidoctor-mathematical`, `asciidoctor-question`, `asciidoctor-rouge`.
   79 attributes | Variables to be referenced in your AsciiDoc file. This is a list of variable name/value maps. See [Asciidoctor's attributes](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions).
   80 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.
   81 safeMode | Safe mode level `unsafe`, `safe`, `server` or `secure`. Don't change this unless you know what you are doing.
   82 sectionNumbers | Auto-number section titles.
   83 verbose | Verbosely print processing information and configuration file checks to stderr.
   84 trace | Include backtrace information on errors.
   85 failureLevel | The minimum logging level that triggers a non-zero exit code (failure).
   86 
   87 Hugo provides additional settings that don't map directly to Asciidoctor's CLI options:
   88 
   89 workingFolderCurrent
   90 : Sets the working directory to be the same as that of the AsciiDoc file being processed, so that [include](https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files) will work with relative paths. This setting uses the `asciidoctor` cli parameter `--base-dir` and attribute `outdir=`. For rendering diagrams with [asciidoctor-diagram](https://asciidoctor.org/docs/asciidoctor-diagram/), `workingFolderCurrent` must be set to `true`.
   91 
   92 preserveTOC
   93 : By default, Hugo removes the table of contents generated by Asciidoctor and provides it through the built-in variable [`.TableOfContents`](/content-management/toc/) to enable further customization and better integration with the various Hugo themes. This option can be set to `true` to preserve Asciidoctor's TOC in the generated page.
   94 
   95 Below are all the AsciiDoc related settings in Hugo with their default values:
   96 
   97 {{< code-toggle config="markup.asciidocExt" />}}
   98 
   99 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.
  100 
  101 Example of how to set extensions and attributes:
  102 
  103 ```
  104 [markup.asciidocExt]
  105     extensions = ["asciidoctor-html5s", "asciidoctor-diagram"]
  106     workingFolderCurrent = true
  107     [markup.asciidocExt.attributes]
  108         my-base-url = "https://example.com/"
  109         my-attribute-name = "my value"
  110 ```
  111 
  112 In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all 
  113 parameters. Run Hugo with `-v`. You will get an output like
  114 
  115 ```
  116 INFO 2019/12/22 09:08:48 Rendering book-as-pdf.adoc with C:\Ruby26-x64\bin\asciidoctor.bat using asciidoc args [--no-header-footer -r asciidoctor-html5s -b html5s -r asciidoctor-diagram --base-dir D:\prototypes\hugo_asciidoc_ddd\docs -a outdir=D:\prototypes\hugo_asciidoc_ddd\build -] ...
  117 ```
  118 
  119 ## Learn Markdown
  120 
  121 Markdown syntax is simple enough to learn in a single sitting. The following are excellent resources to get you up and running:
  122 
  123 * [Daring Fireball: Markdown, John Gruber (Creator of Markdown)][fireball]
  124 * [Markdown Cheatsheet, Adam Pritchard][mdcheatsheet]
  125 * [Markdown Tutorial (Interactive), Garen Torikian][mdtutorial]
  126 * [The Markdown Guide, Matt Cone][mdguide]
  127 
  128 [`emojify` function]: /functions/emojify/
  129 [ascii]: https://asciidoctor.org/
  130 [config]: /getting-started/configuration/
  131 [developer tools]: /tools/
  132 [emojis]: https://www.webpagefx.com/tools/emoji-cheat-sheet/
  133 [fireball]: https://daringfireball.net/projects/markdown/
  134 [gfmtasks]: https://guides.github.com/features/mastering-markdown/#syntax
  135 [helperssource]: https://github.com/gohugoio/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65
  136 [hl]: /content-management/syntax-highlighting/
  137 [hlsc]: /content-management/shortcodes/#highlight
  138 [hugocss]: /css/style.css
  139 [ietf]: https://tools.ietf.org/html/
  140 [mathjaxdocs]: https://docs.mathjax.org/en/latest/
  141 [mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
  142 [mdguide]: https://www.markdownguide.org/
  143 [mdtutorial]: https://www.markdowntutorial.com/
  144 [org]: https://orgmode.org/
  145 [pandoc]: https://www.pandoc.org/
  146 [rest]: https://docutils.sourceforge.io/rst.html
  147 [sc]: /content-management/shortcodes/
  148 [sct]: /templates/shortcode-templates/