diff --git a/Markdown.pl b/Markdown.pl index 43f8935..972d651 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1141,6 +1141,7 @@ sub _RunSpanGamut { $text = _DoItalicsAndBoldAndStrike($text); # Do hard breaks: + $text =~ s/ {3,}\n/
?)\)$/os) { + ($title, $w, $h, $lf, $rt) = (_strip($1), $3, $4, $2, $5); + } elsif ($title =~ /^(.*)\((?)\)$/os) { + ($title, $h, $lf, $rt) = (_strip($1), $3, $2, $4); + } elsif ($title =~ /^(.*)\((?)\)$/os) { + ($title, $w, $lf, $rt) = (_strip($1), $3, $2, $4); + } elsif ($title =~ /^(.*)\((?!\))(?)\)$/os) { + ($title, $lf, $rt) = (_strip($1), $2, $3); } + my $result = ''; + $result .= $g_escape_table{'<'}."center".$g_escape_table{'>'} + if $lf && $rt; + $result .= $g_escape_table{'<'}."img src=\"" . _EncodeAttText($url) . "\""; + $result .= " align=\"left\"" if $lf && !$rt; + $result .= " align=\"right\"" if $rt && !$lf; $result .= " alt=\"" . _EncodeAttText($alt) . "\"" if $alt ne ""; $result .= " width=\"$w\"" if $w != 0; $result .= " height=\"$h\"" if $h != 0; $result .= " title=\"" . _EncodeAttText($title) . "\"" if $title ne ""; $result .= " /" unless $opt{empty_element_suffix} eq ">"; $result .= $g_escape_table{'>'}; + $result .= $g_escape_table{'<'}."/center".$g_escape_table{'>'} + if $lf && $rt; return $result; } diff --git a/syntax.md b/syntax.md index 434e9f1..ae45e9c 100644 --- a/syntax.md +++ b/syntax.md @@ -209,6 +209,9 @@ character in a paragraph into a `
` tag. When you *do* want to insert a `
` break tag using Markdown, you end a line with two or more spaces, then type return. +If you end a line with three or more spaces then a `
` +tag will be generated instead of the plain `
` tag. + Yes, this takes a tad more effort to create a `
`, but a simplistic "every line break is a `
`" rule wouldn't work for Markdown. Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l] @@ -1220,6 +1223,28 @@ The first dimension sets the "width" attribute and the second dimension sets the "height" attribute. The dimensions are then removed from the "title" attribute. +To float an image to the left or right include a "(<)" for left or +"(>)" for right at the end of the title like so: + + [id]: url/to/image "Optional title attribute (<)" + [id]: url/to/image "Optional title attribute (>)" + +These can be combined with the image dimensions like so: + + [id]: url/to/image "Optional title attribute (<512x342)" + [id]: url/to/image "Optional title attribute ()" + [id]: url/to/image "Optional title attribute (?x342>)" + [id]: url/to/image "Optional title attribute (512x?>)" + +Providing both the "float left" (<) and "float right" (>) annotations +at the same time will cause the image to end up centered in its +own "div" like so: + + [id]: url/to/image "Optional title attribute (<>)" + [id]: url/to/image "Optional title attribute (<512x342>)" + It's possible to wrap the url when it's specified in a reference. Both of these examples: