This is the official manual for the latest Org-mode release.

Table of Contents

Next: , Previous: HTML Export commands, Up: HTML export


12.6.2 HTML doctypes

Org can export to various (X)HTML flavors.

Setting the variable org-html-doctype allows you to export to different (X)HTML variants. The exported HTML will be adjusted according to the syntax requirements of that variant. You can either set this variable to a doctype string directly, in which case the exporter will try to adjust the syntax automatically, or you can use a ready-made doctype. The ready-made options are:

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

Fancy HTML5 export

HTML5 introduces several new element types. By default, Org will not make use of these element types, but you can set org-html-html5-fancy to t (or set html5-fancy item in an OPTIONS line), to enable a few new block-level elements. These are created using arbitrary #+BEGIN and #+END blocks. For instance:

     #+BEGIN_ASIDE
     Lorem ipsum
     #+END_ASIDE

Will export to:

     <aside>
       <p>Lorem ipsum</p>
     </aside>

While this:

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

Becomes:

     <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>
     </video>

Special blocks that do not correspond to HTML5 elements (see org-html-html5-elements) will revert to the usual behavior, i.e., #+BEGIN_LEDERHOSEN will still export to ‘<div class="lederhosen">’.

Headlines cannot appear within special blocks. To wrap a headline and its contents in e.g., ‘<section>’ or ‘<article>’ tags, set the HTML_CONTAINER property on the headline itself.