NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #523 most downloaded on Packagist
An HTML-to-markdown conversion helper for PHP
Latest stable
5.2.3
Last release 1 months ago
19 Oct 2026
Ships unpredictably
gaps range from 2 weeks to 3.2 years
Nearly every release is documented
notes for 46 of 46 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
46 releases · first in 2013
Drag across the ruler to compare, or tap a release to open it.
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.
<html>, and processing instructions anywhere, as well as misplaced table parts and long runs of backslashes in table cells when TableConverter is used.The fixes for these issues do not change the Markdown which is output.
<pre> and <code> which looked like those tags, such as </pre>, being removed<pre> and <code> containing > being output as part of their contentFull Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.2.2...5.2.3
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release stops the converter from changing libxml's global error handling setting, which could affect XML handling elsewhere in the application.
This release stops the converter from changing libxml's global error handling setting, which could affect XML handling elsewhere in the application.
suppress_errors option leaving libxml's internal error handling enabled after conversion, which affected later XML handling elsewhere in the application (#268, #269)Thanks to @OmeBlues for reporting #268 and contributing the fix in #269.
Full Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.2.1...5.2.2
This release finishes the fix for autolinks from 5.2.0, so that more links whose text is their URL are output as autolinks.
This release finishes the fix for autolinks from 5.2.0, so that more links whose text is their URL are output as autolinks.
/ for %2F, not being output as autolinks (#248, #284). The autolink keeps the encoded URL._ or * not being output as autolinksThanks to @klkvsk for reporting #248.
Full Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.2.0...5.2.1
This release keeps non-breaking spaces in the Markdown it outputs, and fixes several cases where the output wasn't the Markdown it should have been.
This release keeps non-breaking spaces in the Markdown it outputs, and fixes several cases where the output wasn't the Markdown it should have been.
12,50 € stays on one line (#258, #283). They're output as the characters themselves, not as . Where whitespace is dropped or trimmed, as in text consisting only of whitespace before a block and at the ends of paragraphs, list items, blockquotes and table cells, they now are too, so those used only for spacing still leave nothing behind.Text containing non-breaking spaces between other characters will convert differently than before. This doesn't change how the Markdown renders, but it does change the Markdown itself.
<pre> whose content starts with a newline (#244, #278)& not being output as autolinks (#248, #281)- or + not being escaped, which made it an empty list item- to be taken as a list<pre> or <table> being output on a line of its ownThanks to @dualfroz for the fixes for #244, #248, #258 and #259 in #278, #279, #280 and #281.
Full Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.1.4...5.2.0
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>, <code>, table rows and cells and preserved HTML tags on every version of PHP, and all other elements on older versions of PHP (seen on 8.0 and below).This fix does not change the Markdown which is output.
Full Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.1.3...5.1.4
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: https://github.com/thephpleague/html-to-markdown/compare/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.
fix: honor start="0" on ordered lists by @dualfroz in https://github.com/thephpleague/html-to-markdown/pull/277
Full Changelog: https://github.com/thephpleague/html-to-markdown/compare/5.1.1...5.1.2
Fixed tags with attributes not being parsed (#215, #238)
<pre> tags with attributes not being parsed (#215, #238)Changed horizontal rule style (#218, #219)
Element::getValue() not handling possible nullsFixed 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 tags (#174, #178)
<code> tags (#174, #178)Fixed headers not being placed onto a new line in some cases
Added support for PHP 7.3 :tada:
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)This release adds a new CLI converter!
This release adds a new CLI converter!
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.2.3...master [5.2.3]: https://github.com/thephpleague/html-to-markdown/compar
One column per quarter.