ngx-markdown
Version:
Angular library that uses marked to parse markdown to html combined with Prism.js for synthax highlights
130 lines (129 loc) • 3.89 kB
TypeScript
export declare class KatexSpecificOptions {
/**
* If `true`, math will be rendered in display mode
* (math in display style and center math on page)
*
* If `false`, math will be rendered in inline mode
* @default false
*/
displayMode?: boolean;
/**
* If `true`, KaTeX will throw a `ParseError` when
* it encounters an unsupported command or invalid LaTex
*
* If `false`, KaTeX will render unsupported commands as
* text, and render invalid LaTeX as its source code with
* hover text giving the error, in color given by errorColor
* @default true
*/
throwOnError?: boolean;
/**
* A Color string given in format `#XXX` or `#XXXXXX`
*/
errorColor?: string;
/**
* A collection of custom macros.
*
* See `src/macros.js` for its usage
*/
macros?: any;
/**
* If `true`, `\color` will work like LaTeX's `\textcolor`
* and takes 2 arguments
*
* If `false`, `\color` will work like LaTeX's `\color`
* and takes 1 argument
*
* In both cases, `\textcolor` works as in LaTeX
*
* @default false
*/
colorIsTextColor?: boolean;
/**
* All user-specified sizes will be caped to `maxSize` ems
*
* If set to Infinity, users can make elements and space
* arbitrarily large
*
* @default Infinity
*/
maxSize?: number;
/**
* Limit the number of macro expansions to specified number
*
* If set to `Infinity`, marco expander will try to fully expand
* as in LaTex
*
* @default 1000
*/
maxExpand?: number;
/**
* Allowed protocols in `\href`
*
* Use `_relative` to allow relative urls
*
* Use `*` to allow all protocols
*/
allowedProtocols?: string[];
/**
* If `false` or `"ignore"`, allow features that make
* writing in LaTex convenient but not supported by LaTex
*
* If `true` or `"error"`, throw an error for such transgressions
*
* If `"warn"`, warn about behavior via `console.warn`
*
* @default "warn"
*/
strict?: boolean | string | Function;
}
export interface RenderMathInElementSpecificOptionsDelimiters {
/**
* A string which starts the math expression (i.e. the left delimiter)
*/
left: string;
/**
* A string which ends the math expression (i.e. the right delimiter)
*/
right: string;
/**
* A boolean of whether the math in the expression should be rendered in display mode or not
*/
display: boolean;
}
export interface RenderMathInElementSpecificOptions {
/**
* A list of delimiters to look for math
*
* @default [
* {left: "$$", right: "$$", display: true},
* {left: "\\(", right: "\\)", display: false},
* {left: "\\[", right: "\\]", display: true}
* ]
*/
delimiters?: ReadonlyArray<RenderMathInElementSpecificOptionsDelimiters> | undefined;
/**
* A list of DOM node types to ignore when recursing through
*
* @default ["script", "noscript", "style", "textarea", "pre", "code"]
*/
ignoredTags?: ReadonlyArray<keyof HTMLElementTagNameMap> | undefined;
/**
* A list of DOM node class names to ignore when recursing through
*
* @default []
*/
ignoredClasses?: string[] | undefined;
/**
* A callback method returning a message and an error stack in case of an critical error during rendering
* @param msg Message generated by KaTeX
* @param err Caught error
*
* @default console.error
*/
errorCallback?(msg: string, err: Error): void;
}
/**
* renderMathInElement options contain KaTeX render options and renderMathInElement specific options
*/
export type KatexOptions = KatexSpecificOptions & RenderMathInElementSpecificOptions;