NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #534 most downloaded on Packagist
An HTML-to-markdown conversion helper for PHP
Last release 2 days ago
06 Oct 2026
Ships unpredictably
gaps range from 4 weeks to 3.2 years
Nearly every release is documented
notes for 41 of 41 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
41 releases · first in 2013
This is a security release. All users who convert HTML they don't fully control should upgrade.
This is a security release. All users who convert HTML they don't fully control should upgrade.
<pre> and <code> contents being able to break out of their code block or span (GHSA-8m5h-gv5q-jmp5)href, src, title and alt of links and images being able to break out of the Markdown link or image they are output as (GHSA-r2cp-59h5-vgjj)These fixes change the Markdown which is output in a number of ways, such as how backticks, pipes, and the attributes of links and images are escaped, and where code is kept as HTML. See the changelog for the full list.
Full Changelog: 5.1.2...5.1.3
<pre> and <code> contents being able to break out of their code block or span (GHSA-8m5h-gv5q-jmp5)href, src, title and alt of links and images being able to break out of the Markdown link or image they are output as (GHSA-r2cp-59h5-vgjj)These changes to the output are all part of the fixes above.
alt and title of links and images, are now output as `, and as %60 in URLs. This is visible wherever the Markdown is read without being rendered.alt and title of links and images, &, ", <, >, [, ], \, * and _ are now output as entities", <, >, [, ], \, * and control characters are now percent-encoded, as are parentheses which aren't balanced or are nested more than three deep. A URL containing a space is no longer put in angle brackets.title but no src now has <> as its destination! or ? is no longer output as an autolink<pre>, <blockquote>, <ul>, <ol>, and tables converted by TableConverter, are now separated from anything before them by a blank line. A list nested in a list item directly after a preserved block-level tag becomes a loose list as a result.<code> is now always converted to a code span instead of sometimes becoming a fenced block<code> or <pre> element with its punctuation encoded as entities, which shows as such if the Markdown is rendered with HTML escaped. This applies to:
<code> on the same lines as a preserved block-level tag, such as the first paragraph inside a <div> when strip_tags is disabled, or after a preserved comment<pre> inside of emphasis, a link, a heading or a paragraph, or inside of a list which is the first thing in a list item<pre> containing several <code> elements, or other content alongside one, now becomes a single code block without a language<code> elements are omittedlanguage-* class of a code block is now found among classes separated by any whitespace, and has backticks removed&, " and 
 where the decoded characters used to be, and ` in place of a backtickalt and title of links and images are now replaced by a space, and percent-encoded in URLs<code> following a <br> in a list item is no longer escaped<ol> with a start which isn't a valid list number is numbered from 1TableConverter:
<pre>, or anything else which is kept as HTMLCustom converters aren't covered by these protections, with two exceptions: a blank line is still put before <pre>, <blockquote>, <ul>, <ol> and <table> when they have one, and inline <code> is still kept as HTML where Markdown might not be parsed. A custom converter which outputs block-level HTML of its own around its contents has to protect any code inside of it itself.
One column per quarter.
fix: honor start="0" on ordered lists by @dualfroz in #277
Full Changelog: 5.1.1...5.1.2
Fixed <pre> tags with attributes not being parsed ( #215 , #238 )
<pre> tags with attributes not being parsed (#215, #238)Changed horizontal rule style ( #218 , #219 )
Fixed missplaced comment nodes appearing at the start of the HTML input
Fixed lists not using the correct amount of indentation
This feature is disable by default - see README for how to enable it
strip_placeholder_links option to strip <a> tags without href attributes (#196)ElementInterface:
hasParent()getNextSibling()getPreviousSibling()getListItemLevel()PreConverterInterface to allow converters to perform any necessary pre-parsingHtmlConverter::convert() may now throw a \RuntimeException when unexpected DOMDocument-related errors occurAdded the ability to disable autolinking with a configuration option ( #187 , #188 )
Fixed issue with HTML entity escaping in text
Added new option to preserve comments ( #177 , #179 )
Fixed whitespace preservation around <code> tags ( #174 , #178 )
Fixed headers not being placed onto a new line in some cases
Fixed paragraphs following tables (#165, #166)
The bold_style and italic_style options have been deprecated
HtmlConverterInterface) for the main HtmlConverter classitalic_style option now defaults to '*' so that in-word emphasis is handled properly (#75)<code> and <pre> tags not converting to blocks or inlines properly (#26, #70, #102, #140, #161, #162)<div> elementsbold_style and italic_style options have been deprecated (#75)Added setOptions() function for chainable calling
setOptions() function for chainable calling (#149)list_item_style_alternate option for converting every-other list with a different character (#155)Fixed issue with emphasized spaces
### Fixed - Fixed conversion of tags
<pre> tags (#145)Added support for ordered lists starting at numbers other than 1
Added configuration option for list item style (#135, #136)
Fixed autolinking of invalid URLs
Added hard_break configuration option (#112, #115)
hard_break configuration option (#112, #115)HtmlConverter can now be instantiated with an Environment (#118)br elements (#116, #117)Revised the sanitization implementation
Added full support for PHP 7.0 and 7.1
<pre> and <pre><code> conversions to use backticks instead of indendation (#102)<code> tags nested in <pre> was not converted properly (#70, #102)Fixed sanitization bug which sometimes removes desired content (#63, #101)
Fixed path to autoload.php when used as a library
Added the ability to invoke HtmlConverter objects as functions
Fixed conversion of empty paragraphs
preg_replace so it wouldn't break UTF-8 characters (#79)Added bin/html-to-markdown script
bin/html-to-markdown script_ (#58)Added escaping to avoid * and _ in a text being rendered as emphasis
.styleci.yml and CONTRIBUTING.md are no longer included in distributions (#50)Moving forwards this should reduce the chance of introducing BC-breaking changes.
This release changes the visibility of several methods/properties. #42 and #43 brought to light that some visiblities were not ideally set, so this releases fixes that. Moving forwards this should reduce the chance of introducing BC-breaking changes.
HtmlConverter::getEnvironment() method to expose the Environment (#42, #43)Environment::addConverter() from protected to public, enabling custom converters to be added (#42, #43)HtmlConverter::createDOMDocument() from protected to privateElement::nextCached from protected to privateEnvironment class finalEmpty HTML strings now result in empty Markdown documents (#40, #41)
Added new equals method to Element to check for equality
equals method to Element to check for equalityChanged namespace to League\HTMLToMarkdown
League\HTMLToMarkdownleague/html-to-markdown<a> tags with identical href and inner text are now rendered using angular bracket syntax (#31)<div> elements are now treated as block-level elements (#33)Added support for PHP 5.6 and HHVM
### Fixed - Preserve placeholder links
blocks are now treated as code elements
<pre> blocks are now treated as code elements#text nodes (#17)Added the ability to blacklist/remove specific node types
Added options to customize emphasis characters
Added option to strip HTML tags without Markdown equivalents
convert() method for converter reuse__toString() now returns an empty string if input is emptyFixed first line indentation for multi-line code blocks
[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/5.1.3...master [5.1.3]: https://github.com/thephpleague/html-to-markdown/compar
Your coding agent can read these notes before it upgrades. Set up the MCP server →