@wcj/markdown-to-html
Version:
Converts markdown text to HTML.
27 lines (26 loc) • 1.52 kB
TypeScript
import { PluggableList } from 'unified';
import { Root } from 'hast';
import { Options as RemarkRehypeOptions } from 'remark-rehype';
import { Options as KatexOptions } from 'rehype-katex';
import { RehypeRewriteOptions, getCodeString } from 'rehype-rewrite';
export { getCodeString };
export interface Options {
/** [remark-rehype](https://github.com/remarkjs/remark-rehype) options */
remarkRehypeOptions?: RemarkRehypeOptions;
/** List of [remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins) to use. See the next section for examples on how to pass options */
remarkPlugins?: PluggableList;
/** List of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins) to use. See the next section for examples on how to pass options */
rehypePlugins?: PluggableList;
/** Used to filter default plugins */
filterPlugins?: (type: 'remark' | 'rehype', plugins?: PluggableList) => PluggableList;
/** Resulting Node tree. */
hastNode?: boolean;
/** Rewrite Element. [rehype-rewrite](https://github.com/jaywcjlove/rehype-rewrite#rewritenode-index-parent-void) */
rewrite?: RehypeRewriteOptions['rewrite'];
/** code blocks show line numbers. @default `true` */
showLineNumbers?: boolean;
/** See KaTeX [options](https://katex.org/docs/options.html). */
katexOptions?: KatexOptions;
}
declare function markdown(markdownStr?: string, options?: Options): string | Root;
export default markdown;