API Reference
This section provides detailed documentation for all classes and methods in the Confluence Content Parser.
Core Classes
ConfluenceDocument
- class confluence_content_parser.document.ConfluenceDocument(*, root: ~confluence_content_parser.nodes.Node | None = None, metadata: dict[str, ~typing.Any] = <factory>)[source]
Bases:
BaseModelA parsed Confluence document with convenient access to content.
- find_all() list[Node][source]
- find_all(node_type: type[T1]) list[T1]
- find_all(t1: type[T1], t2: type[T2]) tuple[list[T1], list[T2]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3]) tuple[list[T1], list[T2], list[T3]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3], t4: type[T4]) tuple[list[T1], list[T2], list[T3], list[T4]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3], t4: type[T4], t5: type[T5]) tuple[list[T1], list[T2], list[T3], list[T4], list[T5]]
Find all nodes of specific type(s) in the document with modern variadic generics.
- Parameters:
*node_types – Either no arguments (all nodes), a single node class, or multiple node classes.
- Returns:
list[Node] (all nodes) - Single type: list[T] where T is the requested type - Multiple types: tuple of lists with proper typing for each type
- Return type:
No arguments
Examples
# All nodes all_nodes = document.find_all()
# Single type headings = document.find_all(HeadingElement)
# Multiple types headings, panels = document.find_all(HeadingElement, PanelMacro)
ConfluenceParser
- class confluence_content_parser.parser.ConfluenceParser(*, raise_on_finish: bool = True)[source]
Bases:
objectEfficient Confluence storage-format XML parser with generic element handling.
- NS_AC = 'http://www.atlassian.com/schema/confluence/4/ac/'
- NS_RI = 'http://www.atlassian.com/schema/confluence/4/ri/'
- NS_AT = 'http://www.atlassian.com/schema/confluence/4/at/'
- parse(content: str) ConfluenceDocument[source]
Parse Confluence storage-format XML into a ConfluenceDocument.
ParsingError
Base Node Classes
Node
- class confluence_content_parser.nodes.Node(*, is_block_level: bool = False)[source]
-
Base class for all content nodes in the Confluence document tree.
- find_all() list[Node][source]
- find_all(node_type: type[T1]) list[T1]
- find_all(t1: type[T1], t2: type[T2]) tuple[list[T1], list[T2]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3]) tuple[list[T1], list[T2], list[T3]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3], t4: type[T4]) tuple[list[T1], list[T2], list[T3], list[T4]]
- find_all(t1: type[T1], t2: type[T2], t3: type[T3], t4: type[T4], t5: type[T5]) tuple[list[T1], list[T2], list[T3], list[T4], list[T5]]
Find all nodes of specific type(s) in this subtree with modern variadic generics.
- Parameters:
*node_types – Either no arguments (all nodes), a single node class, or multiple node classes.
- Returns:
list[Node] (all nodes) - Single type: list[T] where T is the requested type - Multiple types: tuple of lists with proper typing for each type
- Return type:
No arguments
Examples
# All nodes all_nodes = node.find_all()
# Single type - returns list[HeadingElement] headings = node.find_all(HeadingElement)
# Multiple types - returns tuple with proper typing headings, panels = node.find_all(HeadingElement, PanelMacro) headings, panels, links = node.find_all(HeadingElement, PanelMacro, LinkElement)
ContainerElement
Text and Formatting Nodes
Text
TextEffectElement
- class confluence_content_parser.nodes.TextEffectElement(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.TextEffectType)[source]
Bases:
ContainerElementBase for inline formatting elements like bold, italic, etc.
- type: TextEffectType
TextEffectType
- class confluence_content_parser.nodes.TextEffectType(*values)[source]
Bases:
EnumType of inline element.
Enumeration of text effect types.
Values:
STRONG- Bold textEMPHASIS- Italic textUNDERLINE- Underlined textSTRIKETHROUGH- Strikethrough textMONOSPACE- Monospace/code textSUBSCRIPT- Subscript textSUPERSCRIPT- Superscript textBLOCKQUOTE- Block quotationSPAN- Generic inline container
TextBreakElement
- class confluence_content_parser.nodes.TextBreakElement(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.TextBreakType)[source]
Bases:
ContainerElementA text break element.
- type: TextBreakType
TextBreakType
Structure Nodes
HeadingElement
- class confluence_content_parser.nodes.HeadingElement(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.HeadingType)[source]
Bases:
ContainerElementA heading element.
- type: HeadingType
HeadingType
List Nodes
ListElement
- class confluence_content_parser.nodes.ListElement(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.ListType, start: int | None = None)[source]
Bases:
ContainerElementA list element.
ListType
ListItem
- class confluence_content_parser.nodes.ListItem(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, task_id: str | None = None, uuid: str | None = None, status: ~confluence_content_parser.nodes.TaskListItemStatus | None = None)[source]
Bases:
ContainerElementA list item element that can be regular or task item.
- status: TaskListItemStatus | None
TaskListItemStatus
Table Nodes
Table
- class confluence_content_parser.nodes.Table(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, width: str | None = None, layout: str | None = None, local_id: str | None = None, display_mode: str | None = None)[source]
Bases:
ContainerElementA table element with metadata and rows.
TableRow
- class confluence_content_parser.nodes.TableRow(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementA table row.
TableCell
- class confluence_content_parser.nodes.TableCell(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, is_header: bool = False, rowspan: int | None = None, colspan: int | None = None)[source]
Bases:
ContainerElementA table cell.
Layout Nodes
LayoutElement
- class confluence_content_parser.nodes.LayoutElement(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementA page layout container containing sections.
LayoutSection
- class confluence_content_parser.nodes.LayoutSection(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, section_type: ~confluence_content_parser.nodes.LayoutSectionType, breakout_mode: str | None = None, breakout_width: str | None = None)[source]
Bases:
ContainerElementA layout section (row) containing cells.
- section_type: LayoutSectionType
LayoutSectionType
- class confluence_content_parser.nodes.LayoutSectionType(*values)[source]
Bases:
EnumType of layout section.
Enumeration of layout section types.
Values:
SINGLE- Single column layoutFIXED_WIDTH- Fixed width layoutTWO_EQUAL- Two equal columnsTWO_LEFT_SIDEBAR- Two columns with left sidebarTWO_RIGHT_SIDEBAR- Two columns with right sidebarTHREE_EQUAL- Three equal columnsTHREE_WITH_SIDEBARS- Three columns with sidebarsTHREE_LEFT_SIDEBARS- Three columns with left sidebarsTHREE_RIGHT_SIDEBARS- Three columns with right sidebarsFOUR_EQUAL- Four equal columnsFIVE_EQUAL- Five equal columns
LayoutCell
- class confluence_content_parser.nodes.LayoutCell(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementA layout cell (column) containing content.
Link and Media Nodes
LinkElement
- class confluence_content_parser.nodes.LinkElement(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.LinkType, href: str | None = None, anchor: str | None = None, space_key: str | None = None, content_title: str | None = None, posting_day: str | None = None, version_at_save: str | None = None, account_id: str | None = None, filename: str | None = None)[source]
Bases:
ContainerElementA link element.
LinkType
- class confluence_content_parser.nodes.LinkType(*values)[source]
Bases:
EnumType of link element.
Enumeration of link types.
Values:
EXTERNAL- External linkMAILTO- Email linkSPACE- Space referencePAGE- Page referenceBLOG_POST- Blog post referenceUSER- User referenceATTACHMENT- Attachment referenceANCHOR- Anchor reference
Image
- class confluence_content_parser.nodes.Image(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, src: str | None = None, alt: str | None = None, title: str | None = None, width: str | None = None, height: str | None = None, alignment: str | None = None, layout: str | None = None, original_height: str | None = None, original_width: str | None = None, custom_width: bool | None = None, filename: str | None = None, version_at_save: str | None = None, url_value: str | None = None)[source]
Bases:
ContainerElementAn image element.
Macro Nodes
PanelMacro
- class confluence_content_parser.nodes.PanelMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, type: ~confluence_content_parser.nodes.PanelMacroType, bg_color: str | None = None, panel_icon: str | None = None, panel_icon_id: str | None = None, panel_icon_text: str | None = None)[source]
Bases:
ContainerElementA panel macro element with background color and optional icon.
- type: PanelMacroType
PanelMacroType
- class confluence_content_parser.nodes.PanelMacroType(*values)[source]
Bases:
EnumType of panel macro based on visual presentation.
Enumeration of panel macro types.
Values:
PANEL- Generic panelNOTE- Note panelSUCCESS- Success panelWARNING- Warning panelERROR- Error panelINFO- Info panel
CodeMacro
StatusMacro
Other Macro Nodes
ExpandMacro
- class confluence_content_parser.nodes.ExpandMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, title: str | None = None, breakout_width: str | None = None)[source]
Bases:
ContainerElementAn expand/collapse macro element.
DetailsMacro
- class confluence_content_parser.nodes.DetailsMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementA details macro element for collapsible content sections.
TocMacro
JiraMacro
IncludeMacro
- class confluence_content_parser.nodes.IncludeMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, space_key: str | None = None, content_title: str | None = None, version_at_save: str | None = None)[source]
Bases:
ContainerElementAn include macro element for including other pages.
TasksReportMacro
ExcerptIncludeMacro
- class confluence_content_parser.nodes.ExcerptIncludeMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, space_key: str | None = None, content_title: str | None = None, posting_day: str | None = None, version_at_save: str | None = None)[source]
Bases:
ContainerElementAn excerpt include macro element.
AttachmentsMacro
ViewPdfMacro
ViewFileMacro
ProfileMacro
- class confluence_content_parser.nodes.ProfileMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, account_id: str | None = None)[source]
Bases:
ContainerElementA profile macro element for displaying user profiles.
AnchorMacro
ExcerptMacro
- class confluence_content_parser.nodes.ExcerptMacro(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementAn excerpt macro element for marking excerptable content.
Decision and Task Nodes
DecisionListItemState
DecisionList
- class confluence_content_parser.nodes.DecisionList(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, local_id: str | None = None)[source]
Bases:
ContainerElementA decision list element containing decision items.
DecisionListItem
- class confluence_content_parser.nodes.DecisionListItem(*, is_block_level: bool = True, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>, local_id: str | None = None, state: ~confluence_content_parser.nodes.DecisionListItemState | None = None)[source]
Bases:
ContainerElementA decision item element.
- state: DecisionListItemState | None
Utility Nodes
Fragment
- class confluence_content_parser.nodes.Fragment(*, is_block_level: bool = False, children: list[~confluence_content_parser.nodes.Node] = <factory>, styles: dict[str, str] = <factory>)[source]
Bases:
ContainerElementNeutral container for multiple top-level nodes (non-rendering).
Emoticon
Time
PlaceholderElement
ResourceIdentifierType
- class confluence_content_parser.nodes.ResourceIdentifierType(*values)[source]
Bases:
EnumType of resource identifier.
Enumeration of resource identifier types.
Values:
PAGE- Page referenceBLOG_POST- Blog post referenceATTACHMENT- Attachment referenceURL- URL referenceSHORTCUT- Shortcut referenceUSER- User referenceSPACE- Space referenceCONTENT_ENTITY- Content entity reference
ResourceIdentifier
- class confluence_content_parser.nodes.ResourceIdentifier(*, is_block_level: bool = False, type: ResourceIdentifierType, space_key: str | None = None, content_title: str | None = None, content_id: str | None = None, posting_day: str | None = None, filename: str | None = None, value: str | None = None, key: str | None = None, parameter: str | None = None, account_id: str | None = None, local_id: str | None = None, userkey: str | None = None, version_at_save: str | None = None)[source]
Bases:
NodeA resource identifier element.
- type: ResourceIdentifierType
Usage Examples
For practical usage examples, see the Examples section and the User Guide.