Add an option to enforce the space when converting atx-style headers
This commit is contained in:
parent
62febd414a
commit
6508d98322
1 changed files with 7 additions and 1 deletions
|
|
@ -73,6 +73,12 @@ class MarkdownExtra extends \Michelf\Markdown {
|
|||
*/
|
||||
public $predef_abbr = array();
|
||||
|
||||
/**
|
||||
* Only convert atx-style headers if there's a space between the header and #
|
||||
* @var boolean
|
||||
*/
|
||||
public $enforce_space_atx_style_headers = false;
|
||||
|
||||
/**
|
||||
* Parser implementation
|
||||
*/
|
||||
|
|
@ -1042,7 +1048,7 @@ class MarkdownExtra extends \Michelf\Markdown {
|
|||
//
|
||||
$text = preg_replace_callback('{
|
||||
^(\#{1,6}) # $1 = string of #\'s
|
||||
[ ]*
|
||||
[ ]'.($this->enforce_space_atx_style_headers ? '+' : '*').'
|
||||
(.+?) # $2 = Header text
|
||||
[ ]*
|
||||
\#* # optional closing #\'s (not counted)
|
||||
|
|
|
|||
Loading…
Reference in a new issue