all2md.parsers.plaintext

Plain text to AST converter.

This module provides a simple converter for plain text files (.txt) that preserves the text content as-is without syntax highlighting or code block formatting.

class all2md.parsers.plaintext.PlainTextToAstConverter

Bases: BaseParser

Convert plain text files to AST representation.

This converter creates a simple AST with the text content preserved as-is without any special formatting or syntax highlighting.

Parameters:

options (BaseParserOptions or None) – Conversion options

Initialize the plain text parser with options and progress callback.

__init__(options: PlainTextParserOptions | None = None, progress_callback: Callable[[ProgressEvent], None] | None = None)

Initialize the plain text parser with options and progress callback.

parse(input_data: str | Path | IO[bytes] | bytes) Document

Parse plain text input into an AST Document.

Parameters:

input_data (str, Path, IO[bytes], or bytes) – The input plain text to parse

Returns:

AST Document node with text content

Return type:

Document

Raises:

ParsingError – If parsing fails

convert_to_ast(content: str) Document

Convert plain text content to AST Document.

Parameters:

content (str) – Plain text content

Returns:

AST document with text content

Return type:

Document

extract_metadata(input_data: str | Path | IO[bytes] | bytes) DocumentMetadata

Extract metadata from plain text file.

Parameters:

input_data (various types) – Input data

Returns:

Basic metadata

Return type:

DocumentMetadata