diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..001c45c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Ignore all tests for archive +/test export-ignore +/.gitattributes export-ignore +/.travis.yml export-ignore +/phpunit.xml.dist export-ignore diff --git a/.travis.yml b/.travis.yml index 3259ca8..db5d725 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,28 @@ language: php -php: - - 7.0 - - 5.6 - - 5.5 - - 5.4 - - 5.3 - - nightly - - hhvm - - hhvm-nightly +dist: trusty +sudo: false matrix: + include: + - php: 5.3 + dist: precise + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: nightly + - php: hhvm + - php: hhvm-nightly fast_finish: true allow_failures: - php: nightly - php: hhvm-nightly install: - - composer install + - composer install --prefer-dist --no-interaction --no-progress script: - - phpunit - - phpunit test/CommonMarkTestWeak.php || true + - vendor/bin/phpunit + - vendor/bin/phpunit test/CommonMarkTestWeak.php || true diff --git a/Parsedown.php b/Parsedown.php index 646af86..f5dd0fa 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -448,7 +448,7 @@ class Parsedown return $Block; } - $Block['element']['text']['text'] .= "\n".$Line['body'];; + $Block['element']['text']['text'] .= "\n".$Line['body']; return $Block; } @@ -515,6 +515,16 @@ class Parsedown ), ); + if($name === 'ol') + { + $listStart = stristr($matches[0], '.', true); + + if($listStart !== '1') + { + $Block['element']['attributes'] = array('start' => $listStart); + } + } + $Block['li'] = array( 'name' => 'li', 'handler' => 'li', @@ -1194,7 +1204,7 @@ class Parsedown $remainder = $Excerpt['text']; - if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches)) + if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches)) { $Element['text'] = $matches[1]; @@ -1207,7 +1217,7 @@ class Parsedown return; } - if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches)) + if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; @@ -1529,10 +1539,10 @@ class Parsedown 'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing', 'i', 'rp', 'del', 'code', 'strike', 'marquee', 'q', 'rt', 'ins', 'font', 'strong', - 's', 'tt', 'sub', 'mark', - 'u', 'xm', 'sup', 'nobr', - 'var', 'ruby', - 'wbr', 'span', - 'time', + 's', 'tt', 'kbd', 'mark', + 'u', 'xm', 'sub', 'nobr', + 'sup', 'ruby', + 'var', 'span', + 'wbr', 'time', ); } diff --git a/README.md b/README.md index fdb1a6f..5f5c38e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> You might also like [Caret](http://caret.io?ref=parsedown) - our Markdown editor for Mac / Windows / Linux. +> You might also like [Caret](https://caret.io?ref=parsedown) - our Markdown editor for Mac / Windows / Linux. ## Parsedown @@ -15,10 +15,11 @@ Better Markdown Parser in PHP ### Features * One File +* No Dependencies * Super Fast * Extensible * [GitHub flavored](https://help.github.com/articles/github-flavored-markdown) -* Tested in 5.3 to 7.0 and in HHVM +* Tested in 5.3 to 7.1 and in HHVM * [Markdown Extra extension](https://github.com/erusev/parsedown-extra) ### Installation @@ -35,11 +36,15 @@ echo $Parsedown->text('Hello _Parsedown_!'); # prints:
Hello Parsedown=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "autoload": { "psr-0": {"Parsedown": ""} }, diff --git a/test/ParsedownTest.php b/test/ParsedownTest.php index 7d07183..fcc232e 100644 --- a/test/ParsedownTest.php +++ b/test/ParsedownTest.php @@ -1,6 +1,8 @@ (link) in parentheses
- \ No newline at end of file + + \ No newline at end of file diff --git a/test/data/inline_link.md b/test/data/inline_link.md index 6bac0b3..1ba24b7 100644 --- a/test/data/inline_link.md +++ b/test/data/inline_link.md @@ -8,4 +8,6 @@ [](http://example.com) -[ and text](http://example.com) \ No newline at end of file +[ and text](http://example.com) + +[ and text](http://example.com) \ No newline at end of file diff --git a/test/data/ordered_list.html b/test/data/ordered_list.html index b6c5216..c4a69db 100644 --- a/test/data/ordered_list.html +++ b/test/data/ordered_list.html @@ -8,6 +8,6 @@large numbers:
-