advanced-markdown
Version:
Production-ready markdown parser with Math (KaTeX), Chemistry (mhchem), and Code Highlighting - all working together flawlessly
79 lines (77 loc) • 1.7 kB
TypeScript
/**
* Options for parsing markdown
*/
interface ParseOptions {
/**
* Enable math rendering with KaTeX
* @default true
*/
enableMath?: boolean;
/**
* Enable chemistry notation support (requires mhchem extension)
* @default true
*/
enableChemistry?: boolean;
/**
* Enable code syntax highlighting with highlight.js
* @default true
*/
enableHighlight?: boolean;
/**
* Typography settings to apply during rendering
*/
typography?: {
/**
* Font family to use
*/
font?: string;
/**
* Line height multiplier
*/
lineHeight?: number;
/**
* Base font size in pixels
*/
bodySize?: number;
/**
* H1 font size in pixels
*/
h1Size?: number;
/**
* H2 font size in pixels
*/
h2Size?: number;
/**
* H3 font size in pixels
*/
h3Size?: number;
/**
* H4 font size in pixels
*/
h4Size?: number;
/**
* H5 font size in pixels
*/
h5Size?: number;
/**
* H6 font size in pixels
*/
h6Size?: number;
};
}
/**
* Parse markdown to HTML
*
* @param markdown - The markdown string to parse
* @param options - Parsing options
* @returns HTML string
*
* @example
* ```typescript
* import { parse } from 'advanced-markdown';
*
* const html = parse('# Hello World\n\nThis is **bold** text with $E = mc^2$');
* ```
*/
declare function parse(markdown: string, options?: ParseOptions): string;
export { type ParseOptions, parse };