grafana/packages/grafana-data/src/utils/markdown.ts
Tobias Skarhed 8541214c9e
Markdown: Replace rendering library (#17686)
* Replace remarkable with marked

* Add wrapper and options for marked
2019-06-26 13:15:45 +02:00

21 lines
479 B
TypeScript

import marked, { MarkedOptions } from 'marked';
const defaultMarkedOptions: MarkedOptions = {
renderer: new marked.Renderer(),
pedantic: false,
gfm: true,
tables: true,
sanitize: true,
smartLists: true,
smartypants: false,
xhtml: false,
};
export function setMarkdownOptions(optionsOverride?: MarkedOptions) {
marked.setOptions({ ...defaultMarkedOptions, ...optionsOverride });
}
export function renderMarkdown(str: string): string {
return marked(str);
}