Skip to content
Browse files

XML-style empty tags were not recognized correctly when the / was not…

… preceded by whitespace. Also made the regex a little more strict, so that </br/> wouldn't be seen as a valid tag.
  • Loading branch information...
1 parent a74017d commit fdd003e0d9e945e0c89a5995e6f48ae3c07b5de8 @michelf committed Dec 2, 2012
Showing with 8 additions and 1 deletion.
  1. +3 −0 PHP Markdown Readme.text
  2. +5 −1 markdown.php
View
3 PHP Markdown Readme.text
@@ -210,6 +210,9 @@ Version History
Current:
+* Fixed an issue where some XML-style empty tags (such as `<br/>`) were not
+ recognized correctly as such when inserted into Markdown-formatted text.
+
* The following HTML 5 elements are treated as block elements when at the
root of an HTML block: `article`, `section`, `nav`, `aside`, `hgroup`,
`header`, `footer`, and `figure`. `svg` too.
View
6 markdown.php
@@ -1522,12 +1522,16 @@ function parseSpan($str) {
|
<\?.*?\?> | <%.*?%> # processing instruction
|
- <[/!$]?[-a-zA-Z0-9:_]+ # regular tags
+ <[!$]?[-a-zA-Z0-9:_]+ # regular tags
(?>
\s
(?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
)?
>
+ |
+ <[-a-zA-Z0-9:_]+\s*/> # xml-style empty tag
+ |
+ </[-a-zA-Z0-9:_]+\s*> # closing tag
').'
)
}xs';

0 comments on commit fdd003e

Please sign in to comment.
Something went wrong with that request. Please try again.