1
0
mirror of https://github.com/erusev/parsedown.git synced 2025-09-03 03:42:38 +02:00

Rename hashtags enabled to strict mode

We can use this to seperate any intentional spec deviations from
spec behaviour so users can pick between compatability and spec
implementations
This commit is contained in:
Aidan Woods
2018-04-02 17:06:31 +01:00
parent d0279cdd3b
commit cf6d23de55
6 changed files with 46 additions and 10 deletions

View File

@@ -90,14 +90,14 @@ class Parsedown
protected $safeMode;
function setHastagsEnabled($hashtagsEnabled)
function setStrictMode($strictMode)
{
$this->hashtagsEnabled = (bool) $hashtagsEnabled;
$this->strictMode = (bool) $strictMode;
return $this;
}
protected $hashtagsEnabled;
protected $strictMode;
protected $safeLinksWhitelist = array(
'http://',
@@ -529,7 +529,8 @@ class Parsedown
$text = trim($Line['text'], '#');
if ($this->hashtagsEnabled and (!isset($text[0]) or $text[0] !== ' ')) {
if ($this->strictMode and ( ! isset($text[0]) or $text[0] !== ' '))
{
return;
}