1001Ferramentas
🔨 Converters

reStructuredText → HTML (basic)

Render simple RST to HTML: underlined headings, lists, *italic*, **bold** and indented code blocks.

HTML gerado:

Preview:

reStructuredText to HTML

In RST, a heading has no marker of its own: it is recognised by the line of symbols right below the text. That makes conversion to HTML less obvious than it sounds — you have to look at the next line before deciding what the current one is. This page does that work and returns the matching HTML, with a preview.

The heading level comes from the symbol used in the adornment, following the most common convention: equals for the first, hyphen for the second and tilde for the third. Asterisk lists become unordered lists, and content text is escaped before entering the HTML, so a less-than sign mid-paragraph appears as a character rather than as markup.

It is worth knowing what stays out, because in RST that is a fair amount: directives, text roles, cross-references, footnotes and tables all depend on interpreting the whole document and on knowing which extensions are in play. To convert full documentation, the tool is Docutils or Sphinx. This page solves the case of reusing a fragment elsewhere.

Frequently asked questions

How does RST know which level is which?
By order of appearance in the document: the first adornment symbol found defines level one, the second distinct symbol defines level two, and so on. No symbol is reserved. The convention used here is the most common in practice, but a document using a different order comes out with swapped levels.
Why was my heading not recognised?
Almost always because the adornment line is shorter than the text. RST requires it to be at least the same length; longer is accepted, shorter is not. It is the error that shows up after editing a title without adjusting the line beneath.
What about Sphinx directives?
They are not converted. They depend on extensions loaded in the project configuration, and each generates its own HTML — the note one, the highlighted code one, the index one. Outside Sphinx there is no way to know what each directive should produce.

Related Tools