Markdown: Replace rendering library (#17686)

* Replace remarkable with marked

* Add wrapper and options for marked
This commit is contained in:
Tobias Skarhed
2019-06-26 13:15:45 +02:00
committed by GitHub
parent 6fb36e705f
commit 8541214c9e
11 changed files with 54 additions and 61 deletions

View File

@@ -1 +1,2 @@
export * from './string';
export * from './markdown';

View File

@@ -0,0 +1,20 @@
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);
}