Skip to content

Commit

Permalink
Fixed issue with new line in fenced code block.
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Nov 10, 2013
1 parent a0e69f5 commit 82489d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "nazar-pc/php-markdown-next",
"version" : "2.0.1",
"version" : "2.0.2",
"type" : "library",
"description" : "PHP Markdown Next",
"homepage" : "https://github.com/nazar-pc/php-markdown-next",
Expand Down
9 changes: 5 additions & 4 deletions src/nazarpc/MarkdownNext.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class MarkdownNext {
static function defaultTransform ($text) {
static $parser_list;
// Try to take parser from the static parser list.
/**
* @var self $parser
*/
$parser = &$parser_list[get_called_class()];
// Create the parser it not already set.
if (!$parser) {
$parser = new static;
$parser = new self;
}
// Transform text using parser.
return $parser->transform($text);
Expand Down Expand Up @@ -633,7 +636,7 @@ protected function _hashHTMLBlocks_inMarkdown ($text, $indent = 0, $enclosing_ta
/**
* Check for: Code span marker
*/
if ($tag[0] == "`") {
if ($tag[0] == '`' && $tag[1] !== '`') {
// Find corresponding end marker.
$tag_re = preg_quote($tag);
if (preg_match(
Expand Down Expand Up @@ -1818,15 +1821,13 @@ protected function doFencedCodeBlocks ($text) {
'.$this->id_class_attr_catch_re.' # 3: Extra attributes
)?
[ ]* \n # Whitespace and newline following marker.
# 4: Content
(
(?>
(?!\1 [ ]* \n) # Not a closing marker.
.*\n+
)+
)
# Closing marker.
\1 [ ]* \n
}xm',
Expand Down

0 comments on commit 82489d4

Please sign in to comment.