render-gfm
Version:
Render GitHub Flavoured Markdown, with CSS for each of GitHub's themes.
32 lines (31 loc) • 1.78 kB
TypeScript
import getCSS from 'generate-github-markdown-css';
/**
* The theme(s) to use when rendering the Markdown.
*/
export declare enum Theme {
Auto = "auto",
Light = "light",
Dark = "dark",
DarkDimmed = "dark_dimmed",
DarkHighContrast = "dark_high_contrast",
LightColorblind = "light_colorblind",
DarkColorblind = "dark_colorblind"
}
export { getCSS };
/**
* Generates and returns CSS for each requested theme in the `themes` array, as an object
* @param {string} outputDir The directory to write the CSS files to. If unspecified, the CSS will still be returned in an object, but not written to the filesystem.
* @param {Theme[]} themes An array of the themes to generate CSS for. Defaults to all themes.
* @returns {Promise<Record<string, string>>} An object containing the CSS for each theme.
*/
export declare function generateCSS(outputDir: string, themes?: Theme[]): Promise<Record<string, string>>;
/**
* Renders Markdown to HTML. If `outputFile` is specified, the HTML will be written to the filesystem.
* The resulting HTML rendered will be wrapped in a default template, unless `includeDefaultTemplate` is set to false.
* This is useful for when you want to use your own HTML template.
* @param {string} markdown The Markdown to render.
* @param {string} outputFile The file to write the rendered HTML to. If unspecified, the HTML will still be returned, but not written to the filesystem.
* @param {boolean} includeDefaultTemplate Whether or not to include the default HTML template. Default: true. If false, the rendered Markdown will not be wrapped in a template.
* @returns {Promise<string>} The rendered HTML.
*/
export default function render(markdown: string, outputFile: string, includeDefaultTemplate?: boolean): Promise<string>;