const renderMarkdownFactory = require('./renderMarkdown');
const renderMarkdown = renderMarkdownFactory();
describe('rho: renderMarkdown service', () => {
it('should convert markdown to HTML', () => {
const content = '# heading 1\n' +
'\n' +
'A paragraph with *bold* and _italic_.\n' +
'\n' +
'* List item 1\n' +
'* List item 2';
const output = renderMarkdown(content);
expect(output).toEqual(
'
heading 1
\n' +
'A paragraph with bold and italic.
\n' +
'\n' +
' - List item 1
\n' +
' - List item 2
\n' +
'
\n');
});
it('should not process markdown inside inline tags', () => {
const content = '# heading {@link some_url_path}';
const output = renderMarkdown(content);
expect(output).toEqual('heading {@link some_url_path}
\n');
});
it('should not put block level inline tags inside paragraphs', () => {
const content = 'A paragraph.\n' +
'\n' +
'{@example blah **blah** blah }\n' +
'\n' +
'Another paragraph';
const output = renderMarkdown(content);
expect(output).toEqual(
'A paragraph.
\n' +
'{@example blah **blah** blah }
\n' +
'Another paragraph
\n');
});
});