This document describes the HTML writers provided by Docutils.
The default length unit in HTML is "px" (pixels, 1 px = 1/96 in).
htmlThe writer name html is an alias for the default Docutils HTML writer.
The default may change with the development of HTML, browsers, Docutils, and the web. Currently, html is mapped to html4css1, it will become an alias for html5 in Docutils 2.0.
Use get_writer_by_name('html') or the rst2html front end, if you want the output to be up-to-date automatically.
Use a specific writer name or front end, if you depend on stability of the generated HTML code, e.g. because you use a custom style sheet or post-processing that may break otherwise.
html5_polyglot, xhtml
The html5 writer generates valid XML that conforms to the HTML standard (polyglot HTML). [1] New features and elements are used if they are widely supported. See the HTML5 test page (and the sources html5-features.rst and html5-text-level-tags.rst) for differences to the html4css1 writer.
There is no hard-coded formatting information in the HTML document. Correct rendering of elements not directly supported by HTML depends on a CSS style sheet. The provided style sheet minimal.css defines required styling rules; plain.css and responsive.css add optional rules for better legibility. Adaption of the layout is possible with custom style sheets. [1]
Image size values with unit are converted to "style" rules, values without unit are rounded to the nearest integer and written as "width" and "height" attributes instead. This allows the specification of the image's aspect ratio (to prevent jank when loading images) without overwriting size declarations in a CSS stylesheet.
html4css1html4, html, xhtml10
The HTML Writer module, docutils/writers/html4css1.py, was the first Docutils writer and up to release 0.13 the only official HTML writer.
The output conforms to the XHTMLâ¯1 Transitional specification. It does not validate as HTMLâ¯4.01 Transitional due to the closing of empty tags required in XML but not allowed in HTMLâ¯4. However, the output follows the HTML Compatibility Guidelines for proper rendering on most HTML user agents.
Correct rendering depends on a CSS style sheet. A reference style sheet, html4css1.css, is provided and used by default.
To support the Internet Explorer (with a market share of about 90% around 2002, the time this writer was written), documents contain some hard-coded formatting hints and are tagged as "text/html" (instead of "application/xhtml+xml"). Additional class values serve as surrogate for the "first"/"last" pseudo-classes introduced in CSS 2.1. [2]
Tables are used for description lists, field lists, docinfo, footnotes, and option lists. Videos and SVG images are wrapped in <object> elements and cannot be embedded.
pep_htmldocutils --reader=pep --writer=pep_html
This is a special writer for the generation of Python Enhancement Proposals (PEPs). It inherits from html4css1 and adds some PEP-specific options, a style sheet and template. It works best in combination with the specialised "pep_html" reader.
s5_htmls5
The s5 writer inherits from html4css1. It produces XHTML for use with S5, the âSimple Standards-based Slide Show Systemâ by Eric Meyer. See Easy Slide Shows With reST & S5 for details.
3rd-party HTML writersFor additional HTML writers, see the Docutils link list and the sandbox.
ReferencesHTML Living Standard. https://html.spec.whatwg.org/multipage/
Transitional version of: XHTML⢠1.0 The Extensible HyperText Markup Language (Second Edition), A Reformulation of HTML 4 in XML 1.0, W3C Recommendation, 26 January 2000, revised 1 August 2002. https://www.w3.org/TR/xhtml1/
Transitional version of: HTML 4.01 Specification, W3C Recommendation 24 December 1999. https://www.w3.org/TR/html4/
The features defined in the CSS1 specification, but using the syntax and definitions in the CSSÂ 2.1 specification.
Cascading Style Sheets Level 2 Revision 1 (CSSâ¯2.1) Specification, W3C Recommendation 07 June 2011. https://www.w3.org/TR/CSS21/
CSS Level 3 builds on CSS Level 2 module by module, using the CSSâ¯2.1 specification as its core.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4