Commit 151b40ee by Tobias Skarhed Committed by Torkel Ödegaard

Markdown: Handle undefined/null strings (#18433)

parent e8adbfea
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 || '');
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment