1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Aidan Woods
d60bcdc469
Bump version 2019-03-17 17:19:46 +00:00
Aidan Woods
c390a9e406
Merge pull request #700 from aidantwoods/fix/spaces-in-class-names-1.7.x
[1.7.x] Fix spaces in class names
2019-03-17 17:14:45 +00:00
Aidan Woods
0f1e9da8f4
Fix test platforms 2019-03-17 17:05:15 +00:00
Aidan Woods
bc003952fc
[1.7.x] Fix spaces in class names 2019-03-17 16:49:45 +00:00
2 changed files with 18 additions and 5 deletions

View File

@ -12,13 +12,12 @@ matrix:
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: nightly
- php: hhvm
- php: hhvm-nightly
fast_finish: true
allow_failures:
- php: nightly
- php: hhvm-nightly
install:
- composer install --prefer-dist --no-interaction --no-progress

View File

@ -17,7 +17,7 @@ class Parsedown
{
# ~
const version = '1.7.1';
const version = '1.7.2';
# ~
@ -429,7 +429,21 @@ class Parsedown
if (isset($matches[1]))
{
$class = 'language-'.$matches[1];
/**
* 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($matches[1], 0, strcspn($matches[1], " \t\n\f\r"));
$class = 'language-'.$language;
$Element['attributes'] = array(
'class' => $class,