all2md.options.org
Configuration options for Org-Mode parsing and rendering.
This module defines options for Org-Mode document conversion.
- class all2md.options.org.OrgParserOptions
Bases:
BaseParserOptionsConfiguration options for Org-Mode-to-AST parsing.
This dataclass contains settings specific to parsing Org-Mode documents into AST representation using orgparse.
- Parameters:
parse_properties (bool, default True) – Whether to parse Org properties within drawers. When True, properties are extracted and stored in metadata.
parse_tags (bool, default True) – Whether to parse heading tags (e.g., :work:urgent:). When True, tags are extracted and stored in heading metadata.
parse_scheduling (bool, default True) – Whether to parse SCHEDULED and DEADLINE timestamps. When True, scheduling info is extracted and stored in metadata. For the first heading, scheduling is also added to Document.metadata.custom.
todo_keywords (list[str], default ["TODO", "DONE"]) – List of TODO keywords to recognize in headings. Common keywords: TODO, DONE, IN-PROGRESS, WAITING, CANCELLED, etc.
Examples
- Basic usage:
>>> options = OrgParserOptions() >>> parser = OrgParser(options)
- Custom TODO keywords:
>>> options = OrgParserOptions( ... todo_keywords=["TODO", "IN-PROGRESS", "DONE", "CANCELLED"] ... )
- parse_properties: bool = True
- parse_tags: bool = True
- parse_scheduling: bool = True
- todo_keywords: list[str]
- parse_logbook: bool = True
- parse_clock: bool = True
- parse_closed: bool = True
- preserve_timestamp_metadata: bool = True
- __init__(extract_metadata: bool = False, parse_properties: bool = True, parse_tags: bool = True, parse_scheduling: bool = True, todo_keywords: list[str] = <factory>, parse_logbook: bool = True, parse_clock: bool = True, parse_closed: bool = True, preserve_timestamp_metadata: bool = True) None
- class all2md.options.org.OrgRendererOptions
Bases:
BaseRendererOptionsConfiguration options for AST-to-Org-Mode rendering.
This dataclass contains settings for rendering AST documents as Org-Mode output.
- Parameters:
heading_style ({"stars"}, default "stars") – Style for rendering headings. Currently only “stars” is supported (e.g.,
*Level 1,**Level 2,***Level 3).preserve_properties (bool, default True) – Whether to preserve properties in rendered output. When True, properties stored in metadata are rendered in :PROPERTIES: drawer.
preserve_tags (bool, default True) – Whether to preserve heading tags in rendered output. When True, tags stored in metadata are rendered (e.g., :work:urgent:).
todo_keywords (list[str], default ["TODO", "DONE"]) – List of TODO keywords that may appear in headings. Used for validation and rendering.
comment_mode ({"comment", "drawer", "ignore"}, default "comment") – How to render Comment and CommentInline AST nodes: - “comment”: Render as Org-mode comments (# Comment text) - “drawer”: Render as :COMMENT: drawer blocks (visible annotations) - “ignore”: Skip comment nodes entirely This controls presentation of comments from source documents.
Notes
- Heading Rendering:
Headings are rendered with stars (
*,**,***, etc.) based on level. TODO states and tags are preserved if present in metadata.- TODO States:
If a heading has
metadata["org_todo_state"], it’s rendered before the heading text. Example:* TODO Write documentation- Tags:
If preserve_tags is True and
metadata["org_tags"]exists, tags are rendered. Example:* Heading :work:urgent:- Properties:
If preserve_properties is True and
metadata["org_properties"]exists, a:PROPERTIES:drawer is rendered under the heading.
- heading_style: Literal['stars'] = 'stars'
- preserve_properties: bool = True
- preserve_tags: bool = True
- todo_keywords: list[str]
- comment_mode: Literal['comment', 'drawer', 'ignore'] = 'comment'
- preserve_logbook: bool = True
- preserve_clock: bool = True
- preserve_closed: bool = True
- __init__(fail_on_resource_errors: bool = False, max_asset_size_bytes: int = 52428800, metadata_policy: MetadataRenderPolicy = <factory>, creator: str | None = 'all2md', heading_style: OrgHeadingStyle = 'stars', preserve_properties: bool = True, preserve_tags: bool = True, todo_keywords: list[str] = <factory>, comment_mode: OrgCommentMode = 'comment', preserve_logbook: bool = True, preserve_clock: bool = True, preserve_closed: bool = True) None