mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add Option minHeaderLevel
Add a new option to define the minimal Header level to be used e.g. if the option `->minHeaderLevel(3)` a header defined with a single hash `# heading` will be parsed as `<h3>heading</h3>`
This commit is contained in:
parent
6598f3860c
commit
b8d675d7b4
@ -83,6 +83,15 @@ class Parsedown
|
|||||||
|
|
||||||
protected $urlsLinked = true;
|
protected $urlsLinked = true;
|
||||||
|
|
||||||
|
function minHeaderLevel($minHeaderLevel)
|
||||||
|
{
|
||||||
|
$this->minHeaderLevel = (int) $minHeaderLevel;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected $minHeaderLevel;
|
||||||
|
|
||||||
function setSafeMode($safeMode)
|
function setSafeMode($safeMode)
|
||||||
{
|
{
|
||||||
$this->safeMode = (bool) $safeMode;
|
$this->safeMode = (bool) $safeMode;
|
||||||
@ -540,6 +549,8 @@ class Parsedown
|
|||||||
{
|
{
|
||||||
$level = strspn($Line['text'], '#');
|
$level = strspn($Line['text'], '#');
|
||||||
|
|
||||||
|
$level = (isset($this->minHeaderLevel) ? $this->minHeaderLevel + $level - 1 : $level);
|
||||||
|
|
||||||
if ($level > 6)
|
if ($level > 6)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user