CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-rinohtype

A comprehensive Python document processing library that renders structured documents to PDF with advanced typography and customizable styling

Pending
Overview
Eval results
Files

document-structure.mddocs/

Document Structure

Core document building blocks that form the hierarchical content structure of rinohtype documents. These elements provide the foundation for creating well-organized, professional documents with proper semantic structure.

Capabilities

Document Tree

The root container that holds all document content and manages the overall document structure.

class DocumentTree(StaticGroupedFlowables):
    """
    Root document content container.
    
    Parameters:
    - flowables: list of Flowable objects representing document content
    - options: dict, optional document-level options
    - style: Style object for document-level styling
    - source: source location information
    """
    def __init__(self, flowables, options=None, style=None, source=None): ...

Sections

Hierarchical document sections that organize content into logical groups with automatic numbering and table of contents integration.

class Section(StaticGroupedFlowables):
    """
    Document section containing flowables with hierarchical organization.
    
    Parameters:
    - flowables: list of Flowable objects in this section
    - id: str, unique identifier for cross-referencing
    - style: Style object for section formatting
    - parent: parent element
    - source: source location information
    """
    def __init__(self, flowables, id=None, style=None, parent=None, source=None): ...
    
    @property
    def level(self): ...  # Section nesting level

Headings

Section titles with automatic numbering, table of contents integration, and hierarchical styling.

class Heading(StaticParagraph):
    """
    Section heading with automatic numbering and TOC integration.
    
    Parameters:
    - content: str or list of inline elements for heading text
    - id: str, unique identifier for cross-referencing
    - style: Style object for heading appearance
    - parent: parent element (typically Section)
    - source: source location information
    """
    def __init__(self, content, id=None, style=None, parent=None, source=None): ...
    
    @property
    def section(self): ...  # Parent section
    
    @property
    def level(self): ...  # Heading level (1-6)

Usage example:

from rinohtype.structure import Section, Heading
from rinohtype.paragraph import Paragraph

# Create nested sections with headings
intro_heading = Heading("Introduction")
intro_content = Paragraph("This introduces the topic...")
intro_section = Section([intro_heading, intro_content], id='intro')

methods_heading = Heading("Methods")  
methods_content = Paragraph("The methodology used...")
methods_section = Section([methods_heading, methods_content], id='methods')

# Nested subsection
analysis_heading = Heading("Data Analysis")
analysis_content = Paragraph("Statistical analysis was performed...")
analysis_section = Section([analysis_heading, analysis_content], id='analysis')

# Add subsection to methods
methods_section.append(analysis_section)

Lists

Ordered and unordered lists with customizable markers, nesting, and item formatting.

class List(GroupedLabeledFlowables):
    """
    Ordered or unordered list container.
    
    Parameters:
    - list_items: list of ListItem objects
    - ordered: bool, whether list is numbered (True) or bulleted (False)
    - start: int, starting number for ordered lists
    - id: str, unique identifier
    - style: ListStyle object for list appearance
    - parent: parent element
    - source: source location information
    """
    def __init__(self, list_items, ordered=False, start=1, id=None, style=None, parent=None, source=None): ...

class ListItem(LabeledFlowable):
    """
    Individual list item with label and content.
    
    Parameters:
    - flowables: list of Flowable objects in the item
    - id: str, unique identifier
    - style: Style object for item formatting
    - parent: parent List element
    - source: source location information
    """
    def __init__(self, flowables, id=None, style=None, parent=None, source=None): ...

class ListItemLabel(Label):
    """Label for list items (bullet or number)."""

class ListStyle(Style):
    """Style configuration for lists including spacing, markers, and indentation."""

Usage example:

from rinohtype.structure import List, ListItem
from rinohtype.paragraph import Paragraph

# Create bulleted list
items = [
    ListItem([Paragraph("First item")]),
    ListItem([Paragraph("Second item")]),  
    ListItem([Paragraph("Third item")])
]
bullet_list = List(items, ordered=False)

# Create numbered list
numbered_items = [
    ListItem([Paragraph("Step one: Prepare materials")]),
    ListItem([Paragraph("Step two: Begin process")]),
    ListItem([Paragraph("Step three: Complete task")])
]
numbered_list = List(numbered_items, ordered=True, start=1)

# Nested list
nested_item = ListItem([
    Paragraph("Main item"),
    List([
        ListItem([Paragraph("Sub-item A")]),
        ListItem([Paragraph("Sub-item B")])
    ], ordered=False)
])

Definition Lists

Definition lists for glossaries, terminology, and key-value content presentation.

class DefinitionList(GroupedLabeledFlowables):
    """
    Definition list containing term-definition pairs.
    
    Parameters:
    - items: list of (term, definition) tuples
    - id: str, unique identifier
    - style: Style object for list formatting
    - parent: parent element
    - source: source location information
    """
    def __init__(self, items, id=None, style=None, parent=None, source=None): ...

Usage example:

from rinohtype.structure import DefinitionList
from rinohtype.paragraph import Paragraph

# Create definition list
definitions = [
    ("API", Paragraph("Application Programming Interface")),
    ("SDK", Paragraph("Software Development Kit")),
    ("IDE", Paragraph("Integrated Development Environment"))
]

def_list = DefinitionList(definitions)

Tables

Comprehensive table system with headers, footers, spanning cells, and flexible formatting.

class Table(Flowable):
    """
    Table with rows, columns, headers, and formatting options.
    
    Parameters:
    - body: TableBody containing table rows
    - head: TableHead, optional header section
    - align: HorizontalAlignment, table alignment
    - width: Dimension, explicit table width
    - column_widths: list of Dimension, column width specifications
    - id: str, unique identifier
    - style: TableStyle object for table appearance
    - parent: parent element
    """
    def __init__(self, body, head=None, align=None, width=None, column_widths=None, id=None, style=None, parent=None): ...

class TableSection(StaticGroupedFlowables):
    """
    Base class for table sections (head, body).
    
    Provides common functionality for organizing table rows into
    logical sections with consistent formatting and behavior.
    """

class TableHead(TableSection):
    """Table header section containing header rows."""

class TableBody(TableSection):
    """Table body section containing data rows."""

class TableRow(Styled):
    """
    Table row containing cells.
    
    Parameters:
    - cells: list of TableCell objects
    - id: str, unique identifier
    - style: Style object for row formatting
    - parent: parent TableSection
    - source: source location information
    """
    def __init__(self, cells, id=None, style=None, parent=None, source=None): ...

class TableCell(StaticGroupedFlowables):
    """
    Individual table cell with content and formatting.
    
    Parameters:
    - flowables: list of Flowable objects in the cell
    - rowspan: int, number of rows to span (default 1)
    - colspan: int, number of columns to span (default 1)
    - id: str, unique identifier
    - style: TableCellStyle object for cell appearance
    - parent: parent TableRow
    - source: source location information
    """
    def __init__(self, flowables, rowspan=1, colspan=1, id=None, style=None, parent=None, source=None): ...

class TableWithCaption(Float):
    """Table with caption as a figure."""

Usage example:

from rinohtype.structure import Table, TableHead, TableBody, TableRow, TableCell
from rinohtype.paragraph import Paragraph

# Create table cells
header_cells = [
    TableCell([Paragraph("Name")]),
    TableCell([Paragraph("Age")]),
    TableCell([Paragraph("City")])
]

data_row1 = [
    TableCell([Paragraph("John Doe")]),
    TableCell([Paragraph("30")]),
    TableCell([Paragraph("New York")])
]

data_row2 = [
    TableCell([Paragraph("Jane Smith")]),
    TableCell([Paragraph("25")]),
    TableCell([Paragraph("Boston")])
]

# Build table structure
header = TableHead([TableRow(header_cells)])
body = TableBody([
    TableRow(data_row1),
    TableRow(data_row2)
])

table = Table(body, head=header)

Headers and Footers

Page headers and footers with dynamic content and flexible positioning.

class Header(GroupedFlowables):
    """
    Page header containing flowables for top-of-page content.
    
    Parameters:
    - flowables: list of Flowable objects for header content
    - id: str, unique identifier
    - style: Style object for header formatting
    - parent: parent element
    - source: source location information
    """
    def __init__(self, flowables, id=None, style=None, parent=None, source=None): ...

class Footer(GroupedFlowables):
    """
    Page footer containing flowables for bottom-of-page content.
    
    Parameters:
    - flowables: list of Flowable objects for footer content
    - id: str, unique identifier
    - style: Style object for footer formatting
    - parent: parent element
    - source: source location information
    """
    def __init__(self, flowables, id=None, style=None, parent=None, source=None): ...

Horizontal Rules

Horizontal separator lines for visual content division.

class HorizontalRule(Flowable):
    """
    Horizontal line separator.
    
    Parameters:
    - id: str, unique identifier
    - style: HorizontalRuleStyle object for line appearance
    - parent: parent element
    - source: source location information
    """
    def __init__(self, id=None, style=None, parent=None, source=None): ...

class HorizontalRuleStyle(Style):
    """Style configuration for horizontal rules including thickness, color, and spacing."""

Admonitions

Special callout blocks for notes, warnings, tips, and other highlighted content.

class Admonition(StaticGroupedFlowables):
    """
    Callout block for special content (note, warning, tip, etc.).
    
    Parameters:
    - flowables: list of Flowable objects in the admonition
    - type: str, admonition type ('note', 'warning', 'tip', etc.)
    - title: str, optional custom title
    - id: str, unique identifier
    - style: AdmonitionStyle object for appearance
    - parent: parent element
    - source: source location information
    """
    def __init__(self, flowables, type='note', title=None, id=None, style=None, parent=None, source=None): ...

class AdmonitionStyle(Style):
    """Style configuration for admonitions including borders, backgrounds, and typography."""

class AdmonitionTitleParagraph(Paragraph):
    """Special paragraph for admonition titles."""

Usage example:

from rinohtype.structure import Admonition
from rinohtype.paragraph import Paragraph

# Create warning admonition
warning = Admonition([
    Paragraph("Be careful when modifying system files.")
], type='warning', title='Important Warning')

# Create note admonition
note = Admonition([
    Paragraph("This feature requires Python 3.8 or later.")
], type='note')

Install with Tessl CLI

npx tessl i tessl/pypi-rinohtype

docs

dimensions.md

document-structure.md

graphics-images.md

index.md

layout-engine.md

references.md

styling-system.md

template-system.md

typography-text.md

tile.json