const renderMarkdownFactory = require('./renderMarkdown'); describe('remark: renderMarkdown service', () => { let renderMarkdown; beforeEach(() => { renderMarkdown = renderMarkdownFactory(); }); 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( '
A paragraph with bold and italic.
\n' + 'A paragraph.
\n' + '{@example blah **blah** blah }\n' + 'Another paragraph {@link _containing_ } an inline tag
\n'); }); it('should not format the contents of tags marked as unformatted ', () => { const content = '' + 'A aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aaaaaaaaaaa\n' + 'foo bbb.' + '
\n'; expect(renderMarkdown(input)).toEqual(output); }); it('should not format indented text as code', () => { const content = 'some text\n\n indented text\n\nother text'; const output = renderMarkdown(content); expect(output).toEqual('some text
\nindented text
\nother text
\n'); }); it('should format triple backtick code blocks as `code-example` tags', () => { const content = '```ts\n' + ' class MyClass {\n' + ' method1() { ... }\n' + ' }\n' + '```'; const output = renderMarkdown(content); expect(output).toEqual( '