Browse Source

Markdown.pl: process "br" indicators at end of paragraph

Normally there's no point to a "<br />" tag at the end of a
paragraph as the end of the paragraph will force a break anyway.

Unless that "br" tag contains a "clear='...'" attribute.

Make sure that 3 or more spaces at the end of a paragraph actually
turns into a "<br clear='all' />" tag but at the same time make 2
spaces at the end of a paragraph just go away as it serves no
purpose.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 3 years ago
parent
commit
38a41b7a8c
  1. 3
      Markdown.pl

3
Markdown.pl

@ -1418,8 +1418,9 @@ sub _RunSpanGamut {
$text = _DoItalicsAndBoldAndStrike($text);
# Do hard breaks:
$text =~ s/ {3,}\n/<br clear=\"all\"$opt{empty_element_suffix}\n/g;
$text =~ s/ {3,}(\n|\z)/<br clear=\"all\"$opt{empty_element_suffix}$1/g;
$text =~ s/ {2,}\n/<br$opt{empty_element_suffix}\n/g;
$text =~ s/ {2,}\z//g;
return $text;
}

Loading…
Cancel
Save