{"id":17844308,"url":"https://github.com/usox/html2text","last_synced_at":"2026-03-19T02:12:32.013Z","repository":{"id":57076163,"uuid":"172895423","full_name":"usox/html2text","owner":"usox","description":"A hacklang script to convert HTML into a plain text format","archived":false,"fork":false,"pushed_at":"2019-02-27T11:28:59.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T05:44:40.355Z","etag":null,"topics":["converter","hacklang","hhvm","html","htmltotext","mail","text"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-27T10:36:14.000Z","updated_at":"2022-09-16T11:27:02.000Z","dependencies_parsed_at":"2022-08-24T14:40:32.911Z","dependency_job_id":null,"html_url":"https://github.com/usox/html2text","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usox%2Fhtml2text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usox%2Fhtml2text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usox%2Fhtml2text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usox%2Fhtml2text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usox","download_url":"https://codeload.github.com/usox/html2text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246837683,"owners_count":20841903,"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":["converter","hacklang","hhvm","html","htmltotext","mail","text"],"created_at":"2024-10-27T21:28:39.827Z","updated_at":"2026-03-19T02:12:26.987Z","avatar_url":"https://github.com/usox.png","language":"HTML","readme":"html2text [![Build Status](https://travis-ci.org/usox/html2text.svg?branch=master)](https://travis-ci.org/usox/html2text) [![Total Downloads](https://poser.pugx.org/usox/html2text/downloads.png)](https://packagist.org/packages/usox/html2text)\n=========\n\nhtml2text is a very simple script that uses DOM methods to convert HTML into a format similar to what would be\nrendered by a browser - perfect for places where you need a quick text representation. For example:\n\n```html\n\u003chtml\u003e\n\u003ctitle\u003eIgnored Title\u003c/title\u003e\n\u003cbody\u003e\n  \u003ch1\u003eHello, World!\u003c/h1\u003e\n\n  \u003cp\u003eThis is some e-mail content.\n  Even though it has whitespace and newlines, the e-mail converter\n  will handle it correctly.\n\n  \u003cp\u003eEven mismatched tags.\u003c/p\u003e\n\n  \u003cdiv\u003eA div\u003c/div\u003e\n  \u003cdiv\u003eAnother div\u003c/div\u003e\n  \u003cdiv\u003eA div\u003cdiv\u003ewithin a div\u003c/div\u003e\u003c/div\u003e\n\n  \u003ca href=\"http://foo.com\"\u003eA link\u003c/a\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nWill be converted into:\n\n```text\nHello, World!\n\nThis is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.\n\nEven mismatched tags.\n\nA div\nAnother div\nA div\nwithin a div\n\n[A link](http://foo.com)\n```\n\n## Installing\n\nYou can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:\n\n```json\n{\n  \"require\": {\n    \"usox/html2text\": \"^1\"\n  }\n}\n```\n\nAnd then use it quite simply:\n\n```php\n$converter = new \\Usox\\Html2Text()\n$text = $converter-\u003econvert($html);\n```\n\nYou can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.\n\n### Options\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| **ignore_errors** | `false` | Set to `true` to ignore any XML parsing errors/warnings. |\n| **drop_links** | `false` | Set to `true` to not render links as `[http://foo.com](My Link)`, but rather just `My Link`. |\n\nPass along options as a second argument to `convert`, for example:\n\n```php\n$html = 'some fine html';\n$options = dict[\n  'ignore_errors' =\u003e true,\n  // other options go here\n];\n$converter = new \\Usox\\Html2Text()\necho $converter-\u003econvert($html, $options);\n```\n\n## Tests\n\nSome very basic tests are provided in the `tests/` directory. Run them with `composer install \u0026\u0026 vendor/bin/hacktest tests`.\n\n## License\n\n`html2text` is [licensed under MIT](LICENSE.md), making it suitable for both Eclipse and GPL projects.\n\n## Other versions\n\nThis is a port of the php version found [here](https://github.com/soundasleep/html2text).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusox%2Fhtml2text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusox%2Fhtml2text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusox%2Fhtml2text/lists"}