markugen
Version:
Markdown to HTML/PDF static site generation tool
123 lines (122 loc) • 3.99 kB
TypeScript
import colors from 'colors';
import { MarkugenOptions } from './markugenoptions';
import { MarkugenDetails } from './markugendetails';
import { PdfOptions } from './pdfgenerator';
import { HtmlOptions } from './htmlgenerator';
export * from './markugendetails';
export * from './htmlgenerator';
export * from './pdfgenerator';
export * from './markugenoptions';
export * from './utils';
export interface OutputLabel {
label: string;
color?: colors.Color;
ignoreQuiet?: boolean;
}
export default class Markugen {
/**
* The version of Markugen
*/
static readonly version: string;
/**
* The name of Markugen
*/
static readonly name: string;
/**
* The home page of Markugen
*/
static readonly homepage: string;
/**
* Root path to the Markugen package
*/
readonly root: string;
/**
* Set to true if this is being ran from the cli
*/
private _options;
/**
* Constructs a new instance with the given {@link options}.
*/
constructor(options?: MarkugenOptions);
/**
* @returns the current configuration options
*/
get options(): MarkugenOptions;
/**
* Sets the configuration options
*/
set options(options: MarkugenOptions);
/**
* This is a synchronous version of {@link generate}. Calling this version
* will ignore the {@link HtmlOptions.pdf} flag and only generate html output.
* See {@link generate} for more details.
* @returns the paths to all generated pages, the html if format === 'string', or
* undefined if an error occurred
*/
mdtohtml(options: HtmlOptions & MarkugenOptions): string | string[] | undefined;
/**
* Generates PDF documents for the given {@link PdfOptions options}.
* @param options the {@link PdfOptions} for generation
* @returns a list of files that were generated
*/
htmltopdf(options: PdfOptions & MarkugenOptions): Promise<string[]>;
/**
* Generates the HTML documentation and PDF files if {@link HtmlOptions.pdf}
* is true.
* @returns the paths to all generated pages, the html if format === 'string', or
* undefined if an error occurred
*/
generate(options: HtmlOptions & MarkugenOptions): Promise<string | string[] | undefined>;
/**
* Starts a console group
*/
group(...args: any[]): void;
/**
* Ends a console group
*/
groupEnd(): void;
/**
* Use in place of console.log so the app can handle coloring
* and any cli options that were given
*/
log(label: OutputLabel | string, ...args: any[]): void;
/**
* Use in place of console.log so the app can handle coloring
* and any cli options that were given
*/
warning(...args: any[]): void;
/**
* Outputs the given error message
* @param e the error to log
*/
error(e: Error): void;
/**
* Escapes all markdown special characters in the given value and returns
* the new string.
*/
static escape(md: any): string;
/**
* Returns an object representing the Markugen properties
*/
static toObject(date?: Date): MarkugenDetails;
/**
* Attempts to locate an executable for Google Chrome
* @returns the path to chrome if found, else returns undefined
*/
static findChrome(): string | undefined;
/**
* Attempts to locate an executable for Google Chrome on Windows
* @returns the path to chrome if found, else returns undefined
*/
static findChromeWindows(): string | undefined;
/**
* Attempts to locate an executable for Google Chrome on Mac
* @returns the path to chrome if found, else returns undefined
*/
static findChromeMac(): string | undefined;
/**
* Attempts to locate an executable for Google Chrome on Linux
* @returns the path to chrome if found, else returns undefined
*/
static findChromeLinux(): string | undefined;
}