mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Port fix for https://github.com/erusev/parsedown/issues/699 into new
codebase
This commit is contained in:
parent
710a6ad250
commit
3f74fe8347
@ -118,7 +118,23 @@ final class FencedCode implements ContinuableBlock
|
||||
*/
|
||||
public function stateRenderable()
|
||||
{
|
||||
$infostring = $this->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).
|
||||
*/
|
||||
$infostring = \substr(
|
||||
$this->infostring(),
|
||||
0,
|
||||
\strcspn($this->infostring(), " \t\n\f\r")
|
||||
);
|
||||
|
||||
return new Element('pre', [], [new Element(
|
||||
'code',
|
||||
|
@ -22,4 +22,7 @@ still a fenced code block
|
||||
|
||||
|
||||
bar
|
||||
</code></pre>
|
||||
<pre><code class="language-php"><?php
|
||||
echo "Hello World";
|
||||
</code></pre>
|
@ -35,4 +35,9 @@ foo
|
||||
|
||||
|
||||
bar
|
||||
```
|
||||
|
||||
```php some-class
|
||||
<?php
|
||||
echo "Hello World";
|
||||
```
|
Loading…
Reference in New Issue
Block a user