rst2pseudoxml(1)

🌸 NAME 🌸

rst2pseudoxml β€” bestie, this is the little glow-up machine that turns reST documents into pseudo-XML ✨ (it's rst2pseudoxml(1), if you're keeping track of the manual number, and honestly iconic of it)


πŸ¦‹ SYNOPSIS πŸ¦‹

rst2pseudoxml [options] [<source> [<destination>]]

πŸ’– DESCRIPTION πŸ’–

Okay so picture this: you've got a standalone reStructuredText source, and you want a pseudo-XML (test) document out the other side. That's the whole gig, no cap. It's giving "doctree, but visible" πŸŽ€

Here's the link if you wanna see what that doctree thing actually is: https://docutils.sourceforge.io/docs/ref/doctree.html πŸ”₯

It reads from <source> β€” and if you don't hand it one, it just reads from stdin, like sure, whatever, it's flexible πŸ’… β€” and it writes to <destination>, which defaults to stdout if you don't say otherwise.

And for the full settings reference, the mothership is right here: https://docutils.sourceforge.io/docs/user/config.html πŸ‘‘


πŸ‘‘ OPTIONS πŸ‘‘

✨ General Docutils Options ✨

  • --output-path=<destination>, --output=<destination> β€” names where the output goes. This one obsoletes the <destination> positional argument (rip bozo, it's legacy now). Default: None, which means stdout πŸ’œ
  • --title=<title> β€” sets the document title as metadata, slay
  • --generator, -g β€” drops in a "Generated by Docutils" credit plus a link 🫢
  • --no-generator β€” no generator credit, periodt
  • --date, -d β€” sticks the date at the end of the document (UTC) πŸ“…
  • --time, -t β€” sticks the time & date in there (UTC) ⏰
  • --no-datestamp β€” no datestamp of any kind, not even a little one
  • --root-prefix=<path> β€” the base directory used for absolute paths when it's reading from your local filesystem. Default is ""
  • --source-link, -s β€” includes a "View document source" link πŸ”—
  • --source-url=<URL> β€” uses <URL> for the source link; heads up, this implies --source-link
  • --no-source-link β€” no "View document source" link, we're shy today πŸ™ˆ
  • --toc-entry-backlinks β€” links from section headers back to TOC entries (this is the default, bestie)
  • --toc-top-backlinks β€” links from section headers to the top of the TOC instead
  • --no-toc-backlinks β€” turns off backlinks to the table of contents entirely
  • --footnote-backlinks β€” links from footnotes/citations back to their references (default 🌸)
  • --no-footnote-backlinks β€” disables backlinks from footnotes and citations
  • --section-numbering β€” lets Docutils number your sections (default πŸ’…)
  • --no-section-numbering β€” Docutils, hands off the numbering
  • --strip-comments β€” removes comment elements from the document tree
  • --leave-comments β€” leaves comment elements in the document tree (default)
  • --strip-elements-with-class=<class> β€” removes every element with classes="<class>" from the document tree. > Warning: potentially dangerous; use with caution. (Multiple-use option β€” you can stack it.)
  • --strip-class=<class> β€” removes all classes="<class>" attributes from elements in the document tree. > Warning: potentially dangerous; use with caution. (Multiple-use option, same deal.)
  • --report=<level>, -r <level> β€” reports system messages at or above <level>: "info" or "1", "warning"/"2" (default), "error"/"3", "severe"/"4", "none"/"5" πŸ“’
  • --verbose, -v β€” reports all system messages. (Same as --report=1.)
  • --quiet, -q β€” reports no system messages at all. (Same as --report=5.) 🀫
  • --halt=<level> β€” halts execution at system messages at or above <level>. Levels work the same as --report. Default: 4 (severe) πŸ›‘
  • --strict β€” halts at the slightest problem. Same as --halt=info. girl is sensitive, respect it 😭
  • --exit-status=<level> β€” enables a non-zero exit status for non-halting system messages at or above <level>. Default: 5 (disabled)
  • --debug β€” enables debug-level system messages and diagnostics πŸ›
  • --no-debug β€” disables debug output. (default)
  • --warnings=<file> β€” sends the output of system messages to <file>
  • --traceback β€” enables Python tracebacks when Docutils is halted
  • --no-traceback β€” disables Python tracebacks. (default)
  • --input-encoding=<name[:handler]> β€” specify the encoding and optionally the error handler of input text. Default: utf-8
  • --output-encoding=<name[:handler]> β€” specify the text encoding and optionally the error handler for output. Default: utf-8
  • --error-encoding=<name[:handler]>, -e <name[:handler]> β€” specify text encoding and optionally the error handler for error output. Default: system encoding
  • --language=<tag>, -l <tag> β€” specify the language (as a BCP 47 language tag). Default: en 🌍
  • --record-dependencies=<file> β€” writes output file dependencies to <file>
  • --config=<file> β€” reads configuration settings from <file>, if it exists
  • --version, -V β€” shows this program's version number and exits
  • --help, -h β€” shows this help message and exits

🌈 Generic Parser Options 🌈

  • --no-file-insertion β€” disables directives that insert the contents of an external file; they get replaced with 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> β€” maximal number of characters in an input line. Default 10 000
  • --legacy-ids β€” keeps identifiers backwards compatible. Default.
  • --matching-ids β€” explicit targets use identifiers matching the reference name.
  • --validate β€” validates the document tree after parsing βœ…
  • --no-validation β€” does not validate the document tree. (default)

🧚 reStructuredText Parser Options 🧚

  • --pep-references β€” recognizes and links to standalone PEP references (like "PEP 258")
  • --pep-base-url=<URL> β€” base URL for PEP references (default "https://peps.python.org/")
  • --pep-file-url-template=<URL> β€” template for the PEP file part of the URL. (default "pep-%04d")
  • --rfc-references β€” recognizes and links to standalone RFC references (like "RFC 822")
  • --rfc-base-url=<URL> β€” base URL for RFC references (default "https://tools.ietf.org/html/")
  • --tab-width=<width> β€” sets the number of spaces for tab expansion (default 8)
  • --trim-footnote-reference-space β€” removes spaces before footnote references
  • --leave-footnote-reference-space β€” leaves spaces before footnote references
  • --syntax-highlight=<format> β€” token name set for parsing code with Pygments: one of "long", "short", or "none" (no parsing). Default is "long" ✨
  • --smart-quotes=<yes/no/alt> β€” changes straight quotation marks into typographic form: one of "yes", "no", "alt[ernative]" (default "no")
  • --smartquotes-locales=<language:quotes[,language:quotes,...]> β€” which characters to use as "smart quotes" for <language>
  • --word-level-inline-markup β€” inline markup is recognized at word boundaries only (adjacent to punctuation or whitespace). Force character-level inline markup recognition with "\" (backslash + space). This is the default.
  • --character-level-inline-markup β€” inline markup is recognized anywhere, regardless of the surrounding characters. Backslash-escapes must be used to avoid unwanted markup recognition. Useful for East Asian languages. Experimental, so, y'know, proceed with the vibes πŸ§ͺ

πŸŽ€ Standalone Reader Options πŸŽ€

  • --no-doc-title β€” disables the promotion of a lone top-level section title to document title (and the subsequent section title to document subtitle promotion, which is enabled by default)
  • --no-doc-info β€” disables the bibliographic field list transform (which is enabled by default)
  • --section-subtitles β€” activates the promotion of lone subsection titles to section subtitles (disabled by default)
  • --no-section-subtitles β€” deactivates the promotion of lone subsection titles

πŸ’œ "Docutils pseudo-XML" Writer Options πŸ’œ

  • --detailed β€” pretty-prints #text nodes πŸ”

ok that's the whole thing, you ate that honestly πŸ“

Sign-off time, bestie: this little masterpiece is rst2pseudoxml(1), filed under text processing πŸ“š, and it lives in the same docutils source as all its siblings. Go forth and generate pseudo-XML, you main character πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from