all2md.options.textile

Configuration options for Textile parsing and rendering.

This module defines options classes for Textile format conversion, supporting both AST parsing and rendering operations.

class all2md.options.textile.TextileParserOptions

Bases: BaseParserOptions

Configuration options for Textile-to-AST parsing.

This dataclass contains settings specific to parsing Textile documents into AST representation using the textile library.

Parameters:
  • strict_mode (bool, default False) – Whether to raise errors on invalid Textile syntax. When False, attempts to recover gracefully.

  • html_passthrough_mode ({"pass-through", "escape", "drop", "sanitize"}, default "escape") – How to handle inline HTML in Textile: - “pass-through”: Preserve HTML unchanged (use only with trusted content) - “escape”: HTML-escape the content to display as text - “drop”: Remove HTML content entirely - “sanitize”: Remove dangerous elements/attributes

Examples

Basic usage:
>>> options = TextileParserOptions()
>>> parser = TextileParser(options)
Strict mode:
>>> options = TextileParserOptions(strict_mode=True)
>>> parser = TextileParser(options)
strict_mode: bool = False
html_passthrough_mode: Literal['pass-through', 'escape', 'drop', 'sanitize'] = 'escape'
__init__(extract_metadata: bool = False, strict_mode: bool = False, html_passthrough_mode: Literal['pass-through', 'escape', 'drop', 'sanitize'] = 'escape') None
class all2md.options.textile.TextileRendererOptions

Bases: BaseRendererOptions

Configuration options for AST-to-Textile rendering.

This dataclass contains settings for rendering AST documents as Textile markup output.

Parameters:
  • use_extended_blocks (bool, default True) – Whether to use extended block notation (bc., bq., etc.). When True, uses bc. for code blocks and bq. for block quotes. When False, uses simpler syntax where possible.

  • line_length (int, default 0) – Target line length for wrapping text (0 = no wrapping).

  • html_passthrough_mode ({"pass-through", "escape", "drop", "sanitize"}, default "pass-through") – How to handle HTMLBlock and HTMLInline nodes: - “pass-through”: Pass through unchanged (use only with trusted content) - “escape”: HTML-escape the content - “drop”: Remove HTML content entirely - “sanitize”: Remove dangerous elements/attributes

  • comment_mode ({"html", "blockquote", "ignore"}, default "html") – How to render Comment and CommentInline AST nodes: - “html”: Use HTML comment syntax <!– –> (default) - “blockquote”: Render as Textile blockquote (bq.) - “ignore”: Skip comments entirely

Examples

Basic usage:
>>> from all2md.ast import Document, Heading, Text
>>> from all2md.renderers.textile import TextileRenderer
>>> from all2md.options.textile import TextileRendererOptions
>>> doc = Document(children=[
...     Heading(level=1, content=[Text(content="Title")])
... ])
>>> options = TextileRendererOptions()
>>> renderer = TextileRenderer(options)
>>> textile_text = renderer.render_to_string(doc)
use_extended_blocks: bool = True
line_length: int = 0
html_passthrough_mode: Literal['pass-through', 'escape', 'drop', 'sanitize'] = 'escape'
comment_mode: Literal['html', 'blockquote', 'ignore'] = 'html'
__init__(fail_on_resource_errors: bool = False, max_asset_size_bytes: int = 52428800, metadata_policy: MetadataRenderPolicy = <factory>, creator: str | None = 'all2md', use_extended_blocks: bool = True, line_length: int = 0, html_passthrough_mode: HtmlPassthroughMode = 'escape', comment_mode: TextileCommentMode = 'html') None