HTML To Markdown for PHP ======================== [![Latest Version](https://img.shields.io/packagist/v/league/html-to-markdown.svg?style=flat-square)](https://packagist.org/packages/league/html-to-markdown) [![Software License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) [![Build Status](https://img.shields.io/travis/thephpleague/html-to-markdown/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/html-to-markdown) [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/thephpleague/html-to-markdown.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/html-to-markdown/code-structure) [![Quality Score](https://img.shields.io/scrutinizer/g/thephpleague/html-to-markdown.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/html-to-markdown) [![Total Downloads](https://img.shields.io/packagist/dt/league/html-to-markdown.svg?style=flat-square)](https://packagist.org/packages/league/html-to-markdown) Library which converts HTML to [Markdown](http://daringfireball.net/projects/markdown/) for your sanity and convenience. **Requires**: PHP 5.3+ **Lead Developer**: [@colinodell](http://twitter.com/colinodell) **Original Author**: [@nickcernis](http://twitter.com/nickcernis) ### Why convert HTML to Markdown? *"What alchemy is this?"* you mutter. *"I can see why you'd convert [Markdown to HTML](https://github.com/thephpleague/commonmark),"* you continue, already labouring the question somewhat, *"but why go the other way?"* Typically you would convert HTML to Markdown if: 1. You have an existing HTML document that needs to be edited by people with good taste. 2. You want to store new content in HTML format but edit it as Markdown. 3. You want to convert HTML email to plain text email. 4. You know a guy who's been converting HTML to Markdown for years, and now he can speak Elvish. You'd quite like to be able to speak Elvish. 5. You just really like Markdown. ### How to use it Require the library in your composer.json: { "require": { "league/html-to-markdown": "~4.0" } } Then `composer install` and add `require 'vendor/autoload.php';` to the top of your script. Next, create a new HtmlConverter instance, passing in your valid HTML code to its `convert()` function: use League\HTMLToMarkdown\HtmlConverter; $converter = new HtmlConverter(); $html = "