all2md.parsers.enex

Evernote Export (ENEX) to AST converter.

This module provides conversion from Evernote Export files (.enex) to AST representation. ENEX files are XML-based exports containing one or more notes with embedded HTML content and base64-encoded attachments.

class all2md.parsers.enex.EnexToAstConverter

Bases: BaseParser

Convert Evernote Export (ENEX) files to AST representation.

This converter processes ENEX XML files and builds an AST that can be rendered to various markdown flavors. It handles multiple notes, embedded HTML content, and base64-encoded attachments.

Parameters:
  • options (EnexOptions or None) – Conversion options

  • progress_callback (ProgressCallback or None) – Optional callback for progress updates during parsing

Initialize the ENEX parser with options and progress callback.

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

Initialize the ENEX parser with options and progress callback.

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

Parse ENEX file into an AST Document.

Parameters:

input_data (str, Path, IO[bytes], or bytes) – The input ENEX document to parse. Can be: - File path (str or Path) - File-like object in binary mode - Raw ENEX bytes

Returns:

AST Document node representing the parsed ENEX structure

Return type:

Document

Raises:
extract_metadata(document: ET.Element) DocumentMetadata

Extract metadata from ENEX document.

Parameters:

document (ET.Element) – ENEX root element

Returns:

Extracted metadata

Return type:

DocumentMetadata