docutils.nodes

Docutils document tree element class library.

Classes in CamelCase are abstract base classes or auxiliary classes. The one exception is Text, for a text (PCDATA) node; uppercase is used to differentiate from element classes. Classes in lower_case_with_underscores are element classes, matching the XML element generic identifiers in the DTD.

The position of each node (the level at which it can occur) is significant and is represented by abstract base classes (Root, Structural, Body, Inline, etc.). Certain transformations will be easier because we can use isinstance(node, base_class) to determine the position of the node in the hierarchy.

Classes

Admonition
BackLinkable
Bibliographic
Body
Decorative
Element Element is the superclass to all specific elements.
FixedTextElement An element which directly contains preformatted text.
General
GenericNodeVisitor Generic “Visitor” abstract superclass, for simple traversals.
Inline
Invisible Internal elements that don’t appear in output.
Labeled Contains a label as its first element.
Node Abstract base class of nodes in a document tree.
NodeVisitor “Visitor” pattern [GoF95] abstract superclass implementation for
Part
PreBibliographic Category of Node which may occur before Bibliographic Nodes.
Referential
Resolvable
Root
Sequential List-like elements.
SparseNodeVisitor Base class for sparse traversals, where only certain node types are of interest.
Special Special internal body elements.
Structural
Targetable
Text Instances are terminal nodes (leaves) containing text only; no child nodes or attributes.
TextElement An element which directly contains text.
Titular
TreeCopyVisitor Make a complete copy of a tree or branch, including element attributes.
abbreviation
acronym
address
admonition
attention
attribution
author
authors
block_quote
bullet_list
caption
caution
citation
citation_reference
classifier
colspec
comment
compound
contact
container
copyright
danger
date
decoration
definition
definition_list
definition_list_item
description
docinfo
doctest_block
document The document root element.
emphasis
entry
enumerated_list
error
field
field_body
field_list
field_name
figure
footer
footnote
footnote_reference
generated
header
hint
image
important
inline
label
legend
line
line_block
list_item
literal
literal_block
math
math_block
note
option
option_argument
option_group
option_list
option_list_item
option_string
organization
paragraph
pending The “pending” element is used to encapsulate a pending operation: the operation (transform), the point at which to apply it, and any data it requires.
problematic
raw Raw data that is to be passed untouched to the Writer.
reference
reprunicode A class that removes the initial u from unicode’s repr.
revision
row
rubric
section
sidebar Sidebars are like miniature, parallel documents that occur inside other documents, providing related or reference material.
status
strong
subscript
substitution_definition
substitution_reference
subtitle
superscript
system_message System message element.
table
target
tbody
term
tgroup
thead
tip
title
title_reference
topic Topics are terminal, “leaf” mini-sections, like block quotes with titles, or textual figures.
transition
version
warning

Exceptions

NodeFound Raise to indicate that the target of a search has been found.
SkipChildren Do not visit any children of the current node.
SkipDeparture Do not call the current node’s depart_... method.
SkipNode Do not visit the current node’s children, and do not call the current
SkipSiblings Do not visit any more siblings (to the right) of the current node.
StopTraversal Stop the traversal alltogether.
TreePruningException Base class for NodeVisitor-related tree pruning exceptions.

Functions

dupname(node, name)
fully_normalize_name(name) Return a case- and whitespace-normalized name.
make_id(string) Convert string into an identifier and return it.
pseudo_quoteattr(value) Quote attributes for pseudo-xml
serial_escape(value) Escape string values that are elements of a list, for serialization.
whitespace_normalize_name(name) Return a whitespace-normalized name.

Defined

  • node_class_names
  • os
  • re
  • sys
  • types
  • unicodedata
  • warnings

Table Of Contents

Previous topic

pick_math_environment

Next topic

Admonition Class