HTML To Markdown for PHP
PHP library that converts HTML documents to Markdown text.
HTML To Markdown for PHP converts an HTML document or fragment into Markdown text. A converter object takes the HTML string and returns Markdown. Options strip tags, remove nodes, keep comments and set how line breaks, links and bold or italic text are written. Tables are converted only after a table converter is added to the environment. The library reads HTML through PHP’s DOM and XML extensions.
The README links league/commonmark and three other libraries for the opposite direction, Markdown to HTML.
Worth knowing
By default the library keeps HTML tags that have no Markdown equivalent, such as span, div, iframe and script, in the output. The strip_tags and remove_nodes options change that.
Identity
Rendering and deploy
- Install with
- composer2
Releases
Adoption
Sources
- 2026-11-16: links, Written in, License, GitHub stars
api.github.com/repos/thephpleague/html-to-markdown - 2026-11-16: links, Categories, Install with
github.com/thephpleague/html-to-markdown/blob/master/README.md - 2026-11-16: Maintainer, License model
github.com/thephpleague/html-to-markdown/blob/master/LICENSE - 2026-11-16: First release, Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/packagist.org/packages/league%2Fhtml-to-markdown - 2026-11-16: Runtime, Minimum runtime
github.com/thephpleague/html-to-markdown/blob/5.2.3/composer.json - 2026-11-16: Packagist downloads
packagist.org/packages/league/html-to-markdown.json - 2026-11-16: Current major version, Last release
github.com/thephpleague/html-to-markdown/releases/tag/5.2.3 - 2026-11-16: Contributors
api.github.com/repos/thephpleague/html-to-markdown/contributors?per_page=1