{"id":13660352,"url":"https://github.com/unlight/html2markdown","last_synced_at":"2025-04-24T19:30:49.493Z","repository":{"id":1820780,"uuid":"2745025","full_name":"unlight/html2markdown","owner":"unlight","description":"HTML to Markdown conversion.","archived":false,"fork":true,"pushed_at":"2011-11-12T01:53:28.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T12:05:49.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"thephpleague/html-to-markdown","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-09T22:40:44.000Z","updated_at":"2020-08-26T11:32:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/unlight/html2markdown","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fhtml2markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fhtml2markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fhtml2markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fhtml2markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/html2markdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250693480,"owners_count":21472268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T05:01:20.466Z","updated_at":"2025-04-24T19:30:49.240Z","avatar_url":"https://github.com/unlight.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"html2markdown for PHP\n=====================\n\nAn HTML-to-markdown conversion tool for PHP by Nick Cernis  \n[@nickcernis](http://twitter.com/nickcernis)  |  http://modnerd.com\n\nVersion 1.0.1  \nRequires PHP 5  \nLicensed under The MIT license: http://www.opensource.org/licenses/mit-license.php\n\n###Live demo\nA live demo is available at http://modnerd.com/html2markdown/\n\n###Instructions\n\nInclude html2markdown.php:\n\t\n\trequire_once( dirname( __FILE__) . '/html2markdown.php' );\n       \nCall html2markdown() on your valid, slash-stripped HTML code:\n\n    $markdown = html2markdown($html);\n    \nThe `$markdown` string now contains the markdowned version of your HTML.\n\nThe included `demo.php` file contains an HTML-\u003emarkdown conversion form for testing.\n\n###Limitations\n\n- Chokes on malformed HTML. i.e. unclosed tags. Am considering a cleanup function to check for simple errors with an off switch for projects that perform their own reformatting, like WordPress. At present, you must nest `\u003ccode\u003e` blocks inside `\u003cp\u003e` or `\u003cpre\u003e`, for example.\n- Markdown Extra, MultiMarkdown and other variants aren't supported; just Markdown.\n\n###Bugs\n\n- Nested lists and lists with multiple paragraphs aren't converted correctly.\n- Lists inside blockquotes aren't converted correctly.\n\n###Style notes\n\n- SETEX (underlined) headers are the default for H1 and H2. Change the HTML2MD_HEADER_STYLE constant to \"ATX\" if you want `# H1` and `## H2` style tags instead.\n- Reference-style labels (with src and href links in the footnotes) are not used. Links and images are all referenced inline.\n- Blockquotes aren't line wrapped (makes them easier to edit).\n\n###Architecture notes\n\nhtml2markdown is about 450 lines. It's a single file with no dependencies. It uses native DOM manipulation libraries (DOMDocument), not regex voodoo, \nto convert code. I'd appreciate your help with any bug fixes and improvements.\n\n###Contributors\n\nMy thanks to [unlight](https://github.com/unlight) and [iamthes](https://github.com/iamthes) for their contributions.\n\n###How it works\nhtml2markdown creates a DOM tree from the supplied HTML, walks through the tree, and converts each node to a text node, starting from the most deeply nested node and working inwards towards the root node.\n\n\n###TO-DO\n\n- Support for nested lists and lists inside blockquotes.\n\n###Trying to convert Markdown to HTML?\n\nUse [PHP Markdown](http://michelf.com/projects/php-markdown/) from Michel Fortin.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fhtml2markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Fhtml2markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fhtml2markdown/lists"}