Skip to content

Commit e0bb3f5

Browse files
committed
Add test for hard linebreak fomatting in markdown
issue2551094 proposes making any newline into a hard linebreak in the html. This is not markdown standard. Standard is two trailing spaces on a line followed by newline. Test that all formatters support it.
1 parent 58c9a43 commit e0bb3f5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test_templating.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ def test_string_markdown_javascript_link(self):
447447
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'[link](javascript:alert(1))'))
448448
self.assertTrue(p.markdown().find('href="javascript:') == -1)
449449

450+
451+
def test_string_markdown_forced_line_break(self):
452+
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'This is a set of text \n:that should have a break \n:at newlines. Each \n:colon should be the start of an html line'))
453+
# sigh different backends render this differently:
454+
# of text <br />
455+
# of text<br>
456+
# etc.
457+
# Rather than using a different result for each
458+
# renderer, look for '<br' and require three of them.
459+
m = p.markdown()
460+
self.assertEqual(3, m.count('<br'))
461+
450462
def test_string_markdown_code_block(self):
451463
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'embedded code block\n\n```\nline 1\nline 2\n```\n\nnew paragraph'))
452464
self.assertEqual(p.markdown().strip().replace('\n\n', '\n'), u2s(u'<p>embedded code block</p>\n<pre><code>line 1\nline 2\n</code></pre>\n<p>new paragraph</p>'))

0 commit comments

Comments
 (0)