rst2html4(1)

πŸ’– rst2html4 β€” the girlies' guide to reST β†’ XHTML πŸ’–

okay bestie, welcome to rst2html4, a manual page from section 1 (text processing) πŸŽ€ she's giving "I turn your reStructuredText into XHTML" and honestly? she ate. ✨


🌸 NAME 🌸

rst2html4 β€” convert reST documents to XHTML πŸ¦‹

no cap, that's the whole job. she takes your reST and hands you back some fresh XHTML.


✨ SYNOPSIS ✨

rst2html4 [options] [<source> [<destination>]]

so you got your options, and then optionally a source and a destination, in that order. the square brackets mean they're optional, she's flexible like that πŸ’…


πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the vibe: rst2html4 generates XHTML 1.1 documents from standalone reStructuredText sources πŸ’–

the reST spec she's working off lives at <https://docutils.sourceforge.io/docs/user/html.html#html4css1> β€” go read it, it's iconic.

she reads from source β€” and if you don't hand her one, the default is stdin 🌈 β€” and she writes to destination, where the default is stdout ⭐. so like, she can just vibe in a pipe if you want. no files required, she's low maintenance.

and if you want the full settings reference (like, the deep lore of every config option), it's right here:

<https://docutils.sourceforge.io/docs/user/config.html>

fr fr, bookmark that one. 🫢


...more coming in part 2, don't go anywhere bestie πŸ’œ

✨ OPTIONS ✨

okay bestie this is the main event, the options list, the whole fitting room πŸ’… every flag rst2html4 will accept, grouped by which part of the machinery it belongs to. scroll, screenshot, live your truth.


🫢 General Docutils Options 🫢

these are the ones that talk to Docutils itself, the whole ecosystem, not just the HTML bit. literally the foundation, the base layer, the primer πŸŽ€

  • --output-path=<destination>, --output=<destination> β€” where the output actually goes, the destination name. heads up: this makes the old <destination> positional argument obsolete (rip bozo). Default: None, which means stdout, so it just spills out into your terminal.
  • --title=<title> β€” set the document title as metadata. metadata only, it's not doing a whole rebrand for you.
  • --generator, -g β€” adds a "Generated by Docutils" credit and link. give the tool its flowers πŸ’
  • --no-generator β€” no generator credit. no credit, no notes, we move in silence.
  • --date, -d β€” slaps the date at the end of the document, in UTC.
  • --time, -t β€” the time and the date, both, in UTC. main character timestamps ✨
  • --no-datestamp β€” no datestamp of any kind. at all. zero. none.
  • --root-prefix=<path> β€” the base directory used for absolute paths when it's reading from the local filesystem. Default: "".
  • --source-link, -s β€” include a "View document source" link.
  • --source-url=<URL> β€” use <URL> for that source link. sneaky detail: this one implies --source-link, so you don't have to ask twice.
  • --no-source-link β€” do not include a "View document source" link. hiding the receipts i see πŸ™ˆ
  • --toc-entry-backlinks β€” links from section headers back to the TOC entries. this is the (default) behavior, so you're already living it.
  • --toc-top-backlinks β€” links from section headers to the very top of the TOC instead of the entry itself.
  • --no-toc-backlinks β€” backlinks to the table of contents? disabled. gone.
  • --footnote-backlinks β€” links from footnotes/citations back to their references. (default) πŸ’–
  • --no-footnote-backlinks β€” no backlinks from footnotes and citations. they can't find their way home.
  • --section-numbering β€” section numbering by Docutils, turned on. this is the (default).
  • --no-section-numbering β€” section numbering by Docutils, turned off. no numbers, just vibes.
  • --strip-comments β€” removes comment elements from the document tree.
  • --leave-comments β€” leaves comment elements in the document tree. (default).
  • --strip-elements-with-class=<class> β€” nukes every element with classes="<class>" from the document tree. ⚠️ Warning: potentially dangerous; use with caution. Also: Multiple-use option, so you can stack it.
  • --strip-class=<class> β€” removes all classes="<class>" attributes from elements in the document tree (the elements stay, the class tag dips). ⚠️ Warning: potentially dangerous; use with caution. Also a Multiple-use option.
  • --report=<level>, -r <level> β€” report system messages at or above <level>. your levels are: info or 1, warning/2 (default), error/3, severe/4, none/5.
  • --verbose, -v β€” report all system messages. same thing as --report=1, just shorter to type.
  • --quiet, -q β€” report no system messages. same thing as --report=5. shhh 🀫
  • --halt=<level> β€” halt execution when system messages hit at or above <level>. levels work like --report. Default: 4 (severe).
  • --strict β€” halts at the slightest problem, no chill whatsoever. same as --halt=info.
  • --exit-status=<level> β€” makes it exit with a non-zero status for non-halting system messages at or above <level>. Default: 5 (which means disabled).
  • --debug β€” enables debug-level system messages and diagnostics. the flashlight πŸ”¦
  • --no-debug β€” disables debug output. (default).
  • --warnings=<file> β€” sends the output of system messages into <file>.
  • --traceback β€” enables Python tracebacks when Docutils gets halted. buckle up 🎒
  • --no-traceback β€” disables Python tracebacks. (default).
  • --input-encoding=<name[:handler]> β€” specify the encoding of input text, and optionally the error handler too. Default: utf-8.
  • --output-encoding=<name[:handler]> β€” specify the text encoding for output and optionally the error handler. Default: utf-8.
  • --error-encoding=<name[:handler]>, -e <name[:handler]> β€” specify text encoding and optionally the error handler for error output. Default: the system encoding.
  • --language=<tag>, -l <tag> β€” specify the language as a BCP 47 language tag. Default: en.
  • --record-dependencies=<file> β€” writes output file dependencies into <file>.
  • --config=<file> β€” read configuration settings from <file>, if it exists. no file, no drama.
  • --version, -V β€” shows this program's version number, then exits.
  • --help, -h β€” shows this help message, then exits. hi, hello, welcome πŸ’–

🌈 Generic Parser Options 🌈

the parser's own little ruleset, shared across the parser family. very "we all agreed on this" energy.

  • --no-file-insertion β€” disables directives that insert the contents of an external file. instead of doing the thing, it swaps in a "warning" system message.
  • --file-insertion-enabled β€” enables directives that insert the contents of an external file. (default).
  • --no-raw β€” disables the "raw" directive; replaced with a "warning" system message. 🚫
  • --raw-enabled β€” enables the "raw" directive. (default).
  • --line-length-limit=<length> β€” the maximum number of characters in one input line. Default 10 000.
  • --legacy-ids β€” keeps identifiers backwards compatible. this one is the Default.
  • --matching-ids β€” explicit targets use identifiers matching the reference name.
  • --validate β€” validates the document tree after parsing. check your work bestie ✨
  • --no-validation β€” does not validate the document tree. (default).

πŸ¦‹ reStructuredText Parser Options πŸ¦‹

this is the reStructuredText-specific section, and honestly it's giving extremely online with the PEP and RFC link recognition. iconic.

  • --pep-references β€” recognizes standalone PEP references (like "PEP 258") and links them.
  • --pep-base-url=<URL> β€” the base URL for PEP references. Default is "https://peps.python.org/".
  • --pep-file-url-template=<URL> β€” template for the PEP file part of the URL. Default "pep-%04d".
  • --rfc-references β€” recognizes standalone RFC references (like "RFC 822") and links them.
  • --rfc-base-url=<URL> β€” base URL for RFC references. Default "https://tools.ietf.org/html/".
  • --tab-width=<width> β€” how many spaces a tab expands to. Default 8.
  • --trim-footnote-reference-space β€” removes the spaces before footnote references. tidy πŸ’…
  • --leave-footnote-reference-space β€” leaves the spaces before footnote references alone.
  • --syntax-highlight=<format> β€” the token name set used for parsing code with Pygments. one of "long", "short", or "none" (which means no parsing at all). Default is "long".
  • --smart-quotes=<yes/no/alt> β€” turns straight quotation marks into typographic form. one of "yes", "no", "alt[ernative]". Default "no".
  • --smartquotes-locales=<language:quotes[,language:quotes,...]> β€” the characters to use as "smart quotes" for a given <language>.
  • --word-level-inline-markup β€” inline markup only gets recognized at word boundaries, meaning adjacent to punctuation or whitespace. if you really want character-level recognition, force it with "" (that's backslash + space). this is the Default.
  • --character-level-inline-markup β€” inline markup gets recognized anywhere, no matter what's surrounding it. so you have to use backslash-escapes to avoid unwanted markup recognition. useful for East Asian languages. labeled Experimental, so, you know, proceed with intention. πŸ§ͺ

πŸ‘‘ Standalone Reader Options πŸ‘‘

the reader that reads your document all by itself. it has opinions about titles.

  • --no-doc-title β€” disables promoting a lone top-level section title into the document title. (which also kills the follow-up move: promoting the subsequent section title into the document subtitle, which is enabled by default.)
  • --no-doc-info β€” disables the bibliographic field list transform. (that one's enabled by default.)
  • --section-subtitles β€” activates promoting lone subsection titles into section subtitles. (disabled by default.)
  • --no-section-subtitles β€” deactivates promoting lone subsection titles. that's it. that's the whole job.

πŸ’œ HTML Writer Options πŸ’œ

where the HTML actually gets its look. styling, structure, the outfit πŸ’…

  • --template=<file> β€” the template file. UTF-8 encoded. Default: "/usr/share/docutils/writers/html4css1/template.txt".
  • --stylesheet=<URL[,URL,...]> β€” comma separated list of stylesheet URLs. this overrides any previous --stylesheet and --stylesheet-path settings, so it wins, periodt.
  • --stylesheet-path=<file[,file,...]> β€” comma separated list of stylesheet paths. relative paths get expanded if a matching file turns up in the --stylesheet-dirs. with --link-stylesheet, the path gets rewritten relative to the output HTML file. Default: "html4css1.css".
  • --stylesheet-dirs=<dir[,dir,...]> β€” comma-separated list of directories where stylesheets live. used by --stylesheet-path when it's expanding relative path arguments. Default: ".,/usr/share/docutils/writers/html4css1,/usr/share/docutils/writers/html5_polyglot".
  • --embed-stylesheet β€” embeds the stylesheet(s) right into the output HTML file. the stylesheet files have to be accessible while it's processing. (default).
  • --link-stylesheet β€” links to the stylesheet(s) in the output HTML file instead.
  • --initial-header-level=<level> β€” sets the initial header level. note it does not touch the document title & subtitle (go look at --no-doc-title for that). Default: 1 for "<h1>".
  • --footnote-references=<format> β€” format for footnote references, one of "superscript" or "brackets". Default: "brackets".
  • --attribution=<format> β€” format for block quote attributions: one of "dash" (em-dash prefix), "parentheses"/"parens", or "none". Default: "dash".
  • --compact-lists β€” removes the extra vertical whitespace between items of "simple" bullet lists and enumerated lists. (default).
  • --no-compact-lists β€” disables compact simple bullet and enumerated lists. let them breathe.
  • --compact-field-lists β€” removes extra vertical whitespace between items of simple field lists. (default).
  • --no-compact-field-lists β€” disables compact simple field lists.
  • --table-style=<style> β€” the class value(s) assigned to all tables. defined styles: borderless, booktabs, align-left, align-center, align-right, colwidths-auto, colwidths-grid.
  • --math-output=<format[option(s)]> β€” math output format (one of "MathML", "HTML", "MathJax", or "LaTeX") plus option(s). Default: "HTML math.css".
  • --xml-declaration β€” prepends an XML declaration. (default).
  • --no-xml-declaration β€” omits the XML declaration.
  • --cloak-email-addresses β€” obfuscates email addresses to confuse harvesters, while still keeping email links usable in standards-compliant browsers. sneaky and thoughtful at the same time 🧚

πŸŽ€ HTML4 Writer Options πŸŽ€

last stretch bestie, just the html4-specific width knobs.

  • --field-name-limit=<level> β€” the maximum width, in characters, for one-column field names. longer field names will span an entire row of the table used to render the field list. Default is 14 characters. use 0 for "no limit".
  • --option-limit=<level> β€” the maximum width, in characters, for options in option lists. longer options will span an entire row of the table used to render the option list. Default is 14 characters. use 0 for "no limit".

and that's the whole page, you made it to the end 🫢 this was the rst2html4(1) manual from Docutils β€” the version and date live down in the source footer, so go check the page you pulled this from for the exact ones. now go convert something and slay πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from