all2md.options.asciidoc

Configuration options for AsciiDoc parsing and rendering.

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

class all2md.options.asciidoc.AsciiDocOptions

Bases: BaseParserOptions

Configuration options for AsciiDoc-to-AST parsing.

This dataclass contains settings specific to parsing AsciiDoc documents into AST representation using a custom parser.

Parameters:
  • parse_attributes (bool, default True) – Whether to parse document attributes (:name: value syntax). When True, attributes are collected and can be referenced.

  • parse_admonitions (bool, default True) – Whether to parse admonition blocks ([NOTE], [IMPORTANT], etc.). When True, admonitions are converted to appropriate AST nodes.

  • parse_includes (bool, default False) – Whether to process include directives (include::file[]). SECURITY: Disabled by default to prevent file system access.

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

  • resolve_attribute_refs (bool, default True) – Whether to resolve attribute references ({name}) in text. When True, {name} is replaced with attribute value.

  • strip_comments (bool, default False) – Whether to strip comments (// syntax) instead of preserving as Comment nodes. When False, comments are preserved as Comment AST nodes with comment_type=’asciidoc’.

parse_attributes: bool = True
parse_admonitions: bool = True
parse_includes: bool = False
strict_mode: bool = False
resolve_attribute_refs: bool = True
attribute_missing_policy: Literal['keep', 'blank', 'warn'] = 'keep'
support_unconstrained_formatting: bool = True
table_header_detection: Literal['first-row', 'attribute-based', 'auto'] = 'attribute-based'
honor_hard_breaks: bool = True
parse_table_spans: bool = True
strip_comments: bool = False
__init__(extract_metadata: bool = False, parse_attributes: bool = True, parse_admonitions: bool = True, parse_includes: bool = False, strict_mode: bool = False, resolve_attribute_refs: bool = True, attribute_missing_policy: Literal['keep', 'blank', 'warn'] = 'keep', support_unconstrained_formatting: bool = True, table_header_detection: Literal['first-row', 'attribute-based', 'auto'] = 'attribute-based', honor_hard_breaks: bool = True, parse_table_spans: bool = True, strip_comments: bool = False) None
class all2md.options.asciidoc.AsciiDocRendererOptions

Bases: BaseRendererOptions

Configuration options for AST-to-AsciiDoc rendering.

This dataclass contains settings for rendering AST documents as AsciiDoc output.

Parameters:
  • list_indent (int, default 2) – Number of spaces for nested list indentation.

  • use_attributes (bool, default True) – Whether to include document attributes in output. When True, renders :name: value attributes at document start.

  • 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 (requires bleach for best results)

  • comment_mode ({"comment", "note", "ignore"}, default "comment") – How to render Comment and CommentInline AST nodes: - “comment”: Render as AsciiDoc comments (// Comment text) - “note”: Render as NOTE admonition blocks (visible annotations) - “ignore”: Skip comment nodes entirely This is the sole option controlling comment rendering behavior.

list_indent: int = 2
use_attributes: bool = True
line_length: int = 0
html_passthrough_mode: Literal['pass-through', 'escape', 'drop', 'sanitize'] = 'escape'
comment_mode: Literal['comment', 'note', 'ignore'] = 'comment'
__init__(fail_on_resource_errors: bool = False, max_asset_size_bytes: int = 52428800, metadata_policy: MetadataRenderPolicy = <factory>, creator: str | None = 'all2md', list_indent: int = 2, use_attributes: bool = True, line_length: int = 0, html_passthrough_mode: HtmlPassthroughMode = 'escape', comment_mode: AsciiDocCommentMode = 'comment') None