diff --git a/Michelf/Markdown.php b/Michelf/Markdown.php index 6ef430c..bd5ff05 100644 --- a/Michelf/Markdown.php +++ b/Michelf/Markdown.php @@ -1846,7 +1846,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { | # Fenced code block marker (?<= ^ | \n ) - [ ]{0,'.($indent+3).'}[`~]{3,} + [ ]{0,'.($indent+3).'}(?:~{3,}|`{3,}) [A-Za-z0-9_\-]* # Language (optional). [ ]* (?: @@ -1919,7 +1919,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { # # Check for: Fenced code block marker. # - else if (preg_match('{^\n?([ ]{0,'.($indent+3).'})([`~]+)}', $tag, $capture)) { + else if (preg_match('{^\n?([ ]{0,'.($indent+3).'})(~+|`+)}', $tag, $capture)) { # Fenced code block marker: find matching end marker. $fence_indent = strlen($capture[1]); # use captured indent in re $fence_re = $capture[2]; # use captured fence in re @@ -2772,7 +2772,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { (?:\n|\A) # 1: Opening marker ( - [`~]{3,} # 3 or more backticks/tildes. + (?:~{3,}|`{3,}) # 3 or more tildes/backticks. ) # 2: Code language marker (optional). ( @@ -2811,7 +2811,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown { array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock); $attr_str = ''; # Initialize string of attributes. - if($language != '') $attr_str .= ' lang="'.$language.'"'; + if($language != '') $attr_str .= ' data-lang="'.$language.'"'; if ($classname != "") { if ($classname{0} == '.')