This release includes support for using an alternative HTML parser that understands HTML5 tags.
The built-in HTML parser does not understand some HTML5 tags such as
<article>, which causes issues when those tags are adjacent to elements that can be automatically closed, such as
<p>. A simple example that is incorrectly parsed with a non-HTML5 parser is below.
<div class="h-entry"> <p class="p-name">Hello World <article class="e-content">The content of the blog post</article> </div>
Without proper knowledge of HTML5 tags such as
<article>, the contents of that tag ends up inside the
p-name in this example. Using an HTML5 parser will properly close the
<p> tag and return the expected result.
php-mf2 library does not automatically install the HTML5 parser, since it does not want to impose additional dependencies on your code base. If you wish to use the HTML5 parser, you can include it in your project explicitly, either by loading it manually or using composer:
composer require masterminds/html5
If this library is present, then the
php-mf2 parser will use it when parsing HTML.