mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Markdown: Handle undefined/null strings (#18433)
This commit is contained in:
parent
e8adbfea9f
commit
151b40ee2f
8
packages/grafana-data/src/utils/markdown.test.ts
Normal file
8
packages/grafana-data/src/utils/markdown.test.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { renderMarkdown } from './markdown';
|
||||
|
||||
describe('Markdown wrapper', () => {
|
||||
it('should be able to handle undefined value', () => {
|
||||
const str = renderMarkdown(undefined);
|
||||
expect(str).toBe('');
|
||||
});
|
||||
});
|
@ -15,6 +15,6 @@ export function setMarkdownOptions(optionsOverride?: MarkedOptions) {
|
||||
marked.setOptions({ ...defaultMarkedOptions, ...optionsOverride });
|
||||
}
|
||||
|
||||
export function renderMarkdown(str: string): string {
|
||||
return marked(str);
|
||||
export function renderMarkdown(str?: string): string {
|
||||
return marked(str || '');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user