Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lib 2.x #385

Merged
merged 9 commits into from
Sep 26, 2022
2 changes: 1 addition & 1 deletion License.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PHP Markdown Lib
Copyright (c) 2004-2021 Michel Fortin
Copyright (c) 2004-2022 Michel Fortin
<https://michelf.ca/>
All rights reserved.

Expand Down
14 changes: 7 additions & 7 deletions Michelf/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2019 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand All @@ -18,7 +18,7 @@ class Markdown implements MarkdownInterface {
* Define the package version
* @var string
*/
const MARKDOWNLIB_VERSION = "2.0";
const MARKDOWNLIB_VERSION = "2.0.0";

/**
* Simple function interface - Initialize the parser and return the result
Expand All @@ -29,7 +29,7 @@ class Markdown implements MarkdownInterface {
* @param string $text
* @return string
*/
public static function defaultTransform($text) {
public static function defaultTransform(string $text): string {
// Take parser class on which this function was called.
$parser_class = static::class;

Expand Down Expand Up @@ -127,10 +127,10 @@ public static function defaultTransform($text) {
* Needed to insert a maximum bracked depth while converting to PHP.
*/
protected int $nested_brackets_depth = 6;
protected $nested_brackets_re;
protected string $nested_brackets_re;

protected int $nested_url_parenthesis_depth = 4;
protected $nested_url_parenthesis_re;
protected string $nested_url_parenthesis_re;

/**
* Table of hash values for escaped characters:
Expand Down Expand Up @@ -167,7 +167,7 @@ public function __construct() {
* Internal hashes used during transformation.
*/
protected array $urls = array();
protected $titles = array();
protected array $titles = array();
protected array $html_hashes = array();

/**
Expand Down Expand Up @@ -213,7 +213,7 @@ protected function teardown() {
* @param string $text
* @return string
*/
public function transform($text) {
public function transform(string $text): string {
$this->setup();

# Remove UTF-8 BOM and marker character in input, if present.
Expand Down
2 changes: 1 addition & 1 deletion Michelf/MarkdownExtra.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2019 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand Down
6 changes: 3 additions & 3 deletions Michelf/MarkdownInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package php-markdown
* @author Michel Fortin <michel.fortin@michelf.com>
* @copyright 2004-2021 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright 2004-2022 Michel Fortin <https://michelf.com/projects/php-markdown/>
* @copyright (Original Markdown) 2004-2006 John Gruber <https://daringfireball.net/projects/markdown/>
*/

Expand All @@ -23,7 +23,7 @@ interface MarkdownInterface {
* @param string $text
* @return string
*/
public static function defaultTransform($text);
public static function defaultTransform(string $text): string;

/**
* Main function. Performs some preprocessing on the input text
Expand All @@ -34,5 +34,5 @@ public static function defaultTransform($text);
* @param string $text
* @return string
*/
public function transform($text);
public function transform(string $text): string;
}
29 changes: 26 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ PHP Markdown

![ci.yml](https://github.com/michelf/php-markdown/actions/workflows/ci.yml/badge.svg)

PHP Markdown Lib 1.9.0 - 1 Dec 2019

by Michel Fortin
<https://michelf.ca/>

Expand Down Expand Up @@ -184,6 +182,31 @@ PHP Markdown, please visit [michelf.ca/donate].
Version History
---------------

PHP Markdown Lib 2.0.0 (26 Sep 2022)

* Now requiring PHP version 7.4 or later.

* Added type annotations to configuration properties of the parser.
(Thanks to Tac Tacelosky.)

* Fixing a TypeError in PHP 8 caused by invalid counter variable.
(Thanks to Alexey Kopytko.)

* Composer package now excludes development files.
(Thanks to Cédric Anne.)


PHP Markdown Lib 1.9.1 (23 Nov 2021)

* Now treating `<details>` and `<summary>` as block level so they don't
get wrapped in `<p>`.
(Thanks to Thomas Hochstein for the fix.)

* Fix for unintended blank title attribute when adding supplementary attributes
to a link in Markdown Extra.
(Thanks to Richie Black for the fix.)


PHP Markdown Lib 1.9.0 (1 Dec 2019)

* Added `fn_backlink_label` configuration variable to put some text in the
Expand Down Expand Up @@ -400,7 +423,7 @@ Copyright and License
---------------------

PHP Markdown Lib
Copyright (c) 2004-2019 Michel Fortin
Copyright (c) 2004-2022 Michel Fortin
<https://michelf.ca/>
All rights reserved.

Expand Down