mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
15 Commits
1.8.0-beta
...
1.8.x-beta
Author | SHA1 | Date | |
---|---|---|---|
87b57bf3cb | |||
fe7a50eceb | |||
7d4c06cb52 | |||
f7b66e6b20 | |||
811bc32726 | |||
8fd5464c46 | |||
c26a2ee4bf | |||
ba3b60d6e4 | |||
0b1e6b8c86 | |||
1f69f7e697 | |||
c83af0a7d5 | |||
4686daf8c2 | |||
c9e7183cfa | |||
9eed1104e7 | |||
fd95703da5 |
@ -13,13 +13,11 @@ matrix:
|
|||||||
- php: 7.0
|
- php: 7.0
|
||||||
- php: 7.1
|
- php: 7.1
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
|
- php: 7.3
|
||||||
- php: nightly
|
- php: nightly
|
||||||
- php: hhvm
|
|
||||||
- php: hhvm-nightly
|
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: nightly
|
- php: nightly
|
||||||
- php: hhvm-nightly
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- composer install --prefer-dist --no-interaction --no-progress
|
- composer install --prefer-dist --no-interaction --no-progress
|
||||||
|
@ -17,7 +17,7 @@ class Parsedown
|
|||||||
{
|
{
|
||||||
# ~
|
# ~
|
||||||
|
|
||||||
const version = '1.8.0-beta-1';
|
const version = '1.8.0-beta-7';
|
||||||
|
|
||||||
# ~
|
# ~
|
||||||
|
|
||||||
@ -317,9 +317,16 @@ class Parsedown
|
|||||||
|
|
||||||
protected function extractElement(array $Component)
|
protected function extractElement(array $Component)
|
||||||
{
|
{
|
||||||
if ( ! isset($Component['element']) and isset($Component['markup']))
|
if ( ! isset($Component['element']))
|
||||||
{
|
{
|
||||||
$Component['element'] = array('rawHtml' => $Component['markup']);
|
if (isset($Component['markup']))
|
||||||
|
{
|
||||||
|
$Component['element'] = array('rawHtml' => $Component['markup']);
|
||||||
|
}
|
||||||
|
elseif (isset($Component['hidden']))
|
||||||
|
{
|
||||||
|
$Component['element'] = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $Component['element'];
|
return $Component['element'];
|
||||||
@ -384,6 +391,11 @@ class Parsedown
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function blockCodeComplete($Block)
|
||||||
|
{
|
||||||
|
return $Block;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Comment
|
# Comment
|
||||||
|
|
||||||
@ -457,7 +469,21 @@ class Parsedown
|
|||||||
|
|
||||||
if ($infostring !== '')
|
if ($infostring !== '')
|
||||||
{
|
{
|
||||||
$Element['attributes'] = array('class' => "language-$infostring");
|
/**
|
||||||
|
* https://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes
|
||||||
|
* Every HTML element may have a class attribute specified.
|
||||||
|
* The attribute, if specified, must have a value that is a set
|
||||||
|
* of space-separated tokens representing the various classes
|
||||||
|
* that the element belongs to.
|
||||||
|
* [...]
|
||||||
|
* The space characters, for the purposes of this specification,
|
||||||
|
* are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab),
|
||||||
|
* U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
|
||||||
|
* U+000D CARRIAGE RETURN (CR).
|
||||||
|
*/
|
||||||
|
$language = substr($infostring, 0, strcspn($infostring, " \t\n\f\r"));
|
||||||
|
|
||||||
|
$Element['attributes'] = array('class' => "language-$language");
|
||||||
}
|
}
|
||||||
|
|
||||||
$Block = array(
|
$Block = array(
|
||||||
@ -501,6 +527,11 @@ class Parsedown
|
|||||||
return $Block;
|
return $Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function blockFencedCodeComplete($Block)
|
||||||
|
{
|
||||||
|
return $Block;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Header
|
# Header
|
||||||
|
|
||||||
@ -1208,14 +1239,14 @@ class Parsedown
|
|||||||
'element' => array(),
|
'element' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$safeText = self::escape($text, true);
|
$Inline['element']['elements'] = self::pregReplaceElements(
|
||||||
|
|
||||||
$Inline['element']['rawHtml'] = preg_replace(
|
|
||||||
$this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/',
|
$this->breaksEnabled ? '/[ ]*+\n/' : '/(?:[ ]*+\\\\|[ ]{2,}+)\n/',
|
||||||
"<br />\n",
|
array(
|
||||||
$safeText
|
array('name' => 'br'),
|
||||||
|
array('text' => "\n"),
|
||||||
|
),
|
||||||
|
$text
|
||||||
);
|
);
|
||||||
$Inline['element']['allowRawHtmlInSafeMode'] = true;
|
|
||||||
|
|
||||||
return $Inline;
|
return $Inline;
|
||||||
}
|
}
|
||||||
|
@ -15,4 +15,6 @@ still a fenced code block</code></pre>
|
|||||||
<pre><code>foo
|
<pre><code>foo
|
||||||
|
|
||||||
|
|
||||||
bar</code></pre>
|
bar</code></pre>
|
||||||
|
<pre><code class="language-php"><?php
|
||||||
|
echo "Hello World";</code></pre>
|
@ -35,4 +35,9 @@ foo
|
|||||||
|
|
||||||
|
|
||||||
bar
|
bar
|
||||||
|
```
|
||||||
|
|
||||||
|
```php some-class
|
||||||
|
<?php
|
||||||
|
echo "Hello World";
|
||||||
```
|
```
|
Reference in New Issue
Block a user