UNPKG

markugen

Version:

Markdown to HTML/PDF static site generation tool

45 lines (44 loc) 1.35 kB
import { PdfOptions } from './pdfoptions'; import Markugen, { MarkugenOptions } from './markugen'; import Generator from './generator'; export * from './pdfoptions'; /** * Generator for HTML to PDF file generation */ export default class PdfGenerator extends Generator { /** * The options to use in generate */ readonly options: Required<PdfOptions>; /** * The list of files to convert */ private readonly files; /** * Constructs a new generator * @param mark the instance of {@link Markugen} */ constructor(mark: Markugen, options: PdfOptions & MarkugenOptions); /** * Generates the PDFs for the given {@link PdfOptions options} * @param options the {@link PdfOptions options} to use for generation * @returns a list of PDF files that were generated */ generate(): Promise<string[]>; /** * Creates the pdf version of the file * @param file the path to the html file or the html string */ private writePdf; /** * Validates the given options * @param options the {@link PdfOptions options} to validate * @returns an array of files to generate PDFs for */ private validate; /** * Collects all html files found in the given directory * @param dir the directory to look in */ private collect; }