mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Markdown: Replace rendering library (#17686)
* Replace remarkable with marked * Add wrapper and options for marked
This commit is contained in:
@@ -1 +1,2 @@
|
||||
export * from './string';
|
||||
export * from './markdown';
|
||||
|
20
packages/grafana-data/src/utils/markdown.ts
Normal file
20
packages/grafana-data/src/utils/markdown.ts
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user