kdp-book-generator
Version:
Generate KDP-compliant PDFs and EPUBs from Markdown for Amazon book publishing
43 lines • 1.27 kB
TypeScript
import { ParsedBook } from '../types';
/**
* Parser for converting Markdown files with YAML front matter into structured book content
*
* Features:
* - YAML front matter extraction for metadata
* - Automatic table of contents generation from H1 headings
* - Chapter extraction and organization
* - Support for page breaks using horizontal rules
* - Inline markdown processing (bold, italic, code)
*/
export declare class MarkdownParser {
private md;
constructor();
private addCustomRules;
/**
* Parse a Markdown string into structured book content
*
* @param markdown - The raw Markdown content with optional YAML front matter
* @returns Parsed book structure including metadata, chapters, and rendered HTML
*
* @example
* ```typescript
* const parser = new MarkdownParser();
* const book = parser.parse(`---
* title: My Book
* author: Author Name
* ---
*
* # Chapter 1
*
* Content here...
* `);
* ```
*/
parse(markdown: string): ParsedBook;
private extractFrontMatter;
private extractChapters;
private extractTableOfContents;
private processInlineMarkdown;
private generateAnchor;
}
//# sourceMappingURL=markdown-parser.d.ts.map