13.9.3 HTML doctypes

Org can export to various (X)HTML flavors.

Set the org-html-doctype variable for different (X)HTML variants. Depending on the variant, the HTML exporter adjusts the syntax of HTML conversion accordingly. Org includes the following ready-made variants:

See the variable org-html-doctype-alist for details. The default is "xhtml-strict".

Org’s HTML exporter does not by default enable new block elements introduced with the HTML5 standard. To enable them, set org-html-html5-fancy to non-nil. Or use an ‘OPTIONS’ line in the file to set ‘html5-fancy’.

HTML5 documents can now have arbitrary ‘#+BEGIN’ … ‘#+END’ blocks. For example:

  Lorem ipsum

exports to:

  <p>Lorem ipsum</p>

while this:

#+ATTR_HTML: :controls controls :width 350
#+HTML: <source src="movie.mp4" type="video/mp4">
#+HTML: <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.

exports to:

<video controls="controls" width="350">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  <p>Your browser does not support the video tag.</p>

When special blocks do not have a corresponding HTML5 element, the HTML exporter reverts to standard translation (see org-html-html5-elements). For example, ‘#+BEGIN_lederhosen’ exports to <div class="lederhosen">.

Special blocks cannot have headlines. For the HTML exporter to wrap the headline and its contents in <section> or <article> tags, set the ‘HTML_CONTAINER’ property for the headline.