@@ -272,6 +272,30 @@ def test_russian(self):
272272 '<h2>%s</h2>\n ' % ko )
273273 test_russian .tags = ["unicode" , "issue3" ]
274274
275+ def test_breaks_and_break_on_newline_together (self ):
276+ # `break-on-newline` is an alias for the breaks extra; supplying both
277+ # in the common list form used to raise TypeError during setup.
278+ expected = '<p>a<br />\n b</p>\n '
279+ self .assertEqual (
280+ markdown2 .markdown ('a\n b' , extras = ['breaks' , 'break-on-newline' ]),
281+ expected )
282+ self .assertEqual (
283+ markdown2 .markdown ('a\n b' , extras = ['break-on-newline' , 'breaks' ]),
284+ expected )
285+ # Each alone keeps its documented behaviour.
286+ self .assertEqual (
287+ markdown2 .markdown ('a\n b' , extras = ['break-on-newline' ]), expected )
288+ self .assertEqual (
289+ markdown2 .markdown ('a\n b' , extras = ['breaks' ]), '<p>a\n b</p>\n ' )
290+ # A breaks dict with other options is preserved, not overwritten.
291+ self .assertEqual (
292+ markdown2 .markdown (
293+ 'a\\ \n b' ,
294+ extras = {'breaks' : {'on_backslash' : True },
295+ 'break-on-newline' : None }),
296+ '<p>a<br />\n b</p>\n ' )
297+ test_breaks_and_break_on_newline_together .tags = ["breaks" , "extras" ]
298+
275299 def test_metadata_no_blank_line (self ):
276300 # A single-block document with no blank line (e.g. a tab-indented code
277301 # block) gives the metadata extra nothing to split on, so re.split
0 commit comments