autowriterllm package
Submodules
autowriterllm.ai_content_generator module
autowriterllm.markdown_to_pdf_converter module
- class autowriterllm.markdown_to_pdf_converter.ConverterConfig(max_workers: int = 4, supported_encodings: ~typing.List[str] = <factory>, temp_filename: str = 'combined_temp.md', pandoc_options: ~typing.Dict[str, ~typing.Any] = <factory>)[source]
Bases:
objectConfiguration settings for the PDF converter.
- Variables:
- class autowriterllm.markdown_to_pdf_converter.ConverterGUI[source]
Bases:
objectGUI interface for the markdown to PDF converter.
- class autowriterllm.markdown_to_pdf_converter.MarkdownToPDFConverter(toc_file: Path, output_dir: Path, css_file: Path | None = None, config: ConverterConfig | None = None)[source]
Bases:
objectConverts markdown files to a single PDF document using pandoc.
- __init__(toc_file: Path, output_dir: Path, css_file: Path | None = None, config: ConverterConfig | None = None)[source]
Initialize the converter.
- Parameters:
toc_file – Path to table of contents markdown file
output_dir – Directory containing markdown files
css_file – Optional path to custom CSS file
config – Optional configuration settings
- Raises:
ValueError – If toc_file or output_dir don’t exist
- _create_combined_markdown(temp_md: Path, contents: List[str])[source]
Create a combined markdown file from processed markdown content.
- _parse_toc() List[str][source]
Parse table of contents to get ordered list of markdown files.
- Returns:
Ordered list of markdown filenames
- Return type:
List[str]
- Example ordering:
chapter-1.md chapter-1-1.md chapter-1-1-1.md chapter-1-2.md chapter-2.md chapter-2-1.md
- _process_markdown_files(files: List[str]) List[str][source]
Process markdown files in parallel.
- Parameters:
files – List of markdown filenames to process
- Returns:
Processed markdown content
- Return type:
List[str]
- Raises:
RuntimeError – If any file processing fails
- _read_file_with_fallback_encoding(file_path: Path) str[source]
Read file content with fallback encodings.
- _run_pandoc_conversion(temp_md: Path, output_file: Path)[source]
Run pandoc conversion using the combined markdown file.
- convert_to_pdf(output_file: Path) None[source]
Convert markdown files to PDF using pandoc.
- Parameters:
output_file – Path where the output PDF will be saved
- Raises:
RuntimeError – If conversion fails
FileNotFoundError – If required dependencies are missing
Module contents
AutoWriterLLM - Automatic book writing tool using LLMs.