METADATA 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Metadata-Version: 2.1
  2. Name: html2text
  3. Version: 2020.1.16
  4. Summary: Turn HTML into equivalent Markdown-structured text.
  5. Home-page: https://github.com/Alir3z4/html2text/
  6. Author: Aaron Swartz
  7. Author-email: me@aaronsw.com
  8. Maintainer: Alireza Savand
  9. Maintainer-email: alireza.savand@gmail.com
  10. License: GNU GPL 3
  11. Platform: OS Independent
  12. Classifier: Development Status :: 5 - Production/Stable
  13. Classifier: Intended Audience :: Developers
  14. Classifier: License :: OSI Approved :: GNU General Public License (GPL)
  15. Classifier: Operating System :: OS Independent
  16. Classifier: Programming Language :: Python
  17. Classifier: Programming Language :: Python :: 3
  18. Classifier: Programming Language :: Python :: 3.5
  19. Classifier: Programming Language :: Python :: 3.6
  20. Classifier: Programming Language :: Python :: 3.7
  21. Classifier: Programming Language :: Python :: 3.8
  22. Classifier: Programming Language :: Python :: 3 :: Only
  23. Classifier: Programming Language :: Python :: Implementation :: CPython
  24. Classifier: Programming Language :: Python :: Implementation :: PyPy
  25. Requires-Python: >=3.5
  26. Description-Content-Type: text/markdown
  27. # html2text
  28. [![Build Status](https://secure.travis-ci.org/Alir3z4/html2text.png)](https://travis-ci.org/Alir3z4/html2text)
  29. [![Coverage Status](https://coveralls.io/repos/Alir3z4/html2text/badge.png)](https://coveralls.io/r/Alir3z4/html2text)
  30. [![Downloads](http://badge.kloud51.com/pypi/d/html2text.png)](https://pypi.org/project/html2text/)
  31. [![Version](http://badge.kloud51.com/pypi/v/html2text.png)](https://pypi.org/project/html2text/)
  32. [![Wheel?](http://badge.kloud51.com/pypi/wheel/html2text.png)](https://pypi.org/project/html2text/)
  33. [![Format](http://badge.kloud51.com/pypi/format/html2text.png)](https://pypi.org/project/html2text/)
  34. [![License](http://badge.kloud51.com/pypi/license/html2text.png)](https://pypi.org/project/html2text/)
  35. html2text is a Python script that converts a page of HTML into clean, easy-to-read plain ASCII text. Better yet, that ASCII also happens to be valid Markdown (a text-to-HTML format).
  36. Usage: `html2text [filename [encoding]]`
  37. | Option | Description
  38. |--------------------------------------------------------|---------------------------------------------------
  39. | `--version` | Show program's version number and exit
  40. | `-h`, `--help` | Show this help message and exit
  41. | `--ignore-links` | Don't include any formatting for links
  42. |`--escape-all` | Escape all special characters. Output is less readable, but avoids corner case formatting issues.
  43. | `--reference-links` | Use reference links instead of links to create markdown
  44. | `--mark-code` | Mark preformatted and code blocks with [code]...[/code]
  45. For a complete list of options see the [docs](https://github.com/Alir3z4/html2text/blob/master/docs/usage.md)
  46. Or you can use it from within `Python`:
  47. ```
  48. >>> import html2text
  49. >>>
  50. >>> print(html2text.html2text("<p><strong>Zed's</strong> dead baby, <em>Zed's</em> dead.</p>"))
  51. **Zed's** dead baby, _Zed's_ dead.
  52. ```
  53. Or with some configuration options:
  54. ```
  55. >>> import html2text
  56. >>>
  57. >>> h = html2text.HTML2Text()
  58. >>> # Ignore converting links from HTML
  59. >>> h.ignore_links = True
  60. >>> print h.handle("<p>Hello, <a href='https://www.google.com/earth/'>world</a>!")
  61. Hello, world!
  62. >>> print(h.handle("<p>Hello, <a href='https://www.google.com/earth/'>world</a>!"))
  63. Hello, world!
  64. >>> # Don't Ignore links anymore, I like links
  65. >>> h.ignore_links = False
  66. >>> print(h.handle("<p>Hello, <a href='https://www.google.com/earth/'>world</a>!"))
  67. Hello, [world](https://www.google.com/earth/)!
  68. ```
  69. *Originally written by Aaron Swartz. This code is distributed under the GPLv3.*
  70. ## How to install
  71. `html2text` is available on pypi
  72. https://pypi.org/project/html2text/
  73. ```
  74. $ pip install html2text
  75. ```
  76. ## How to run unit tests
  77. tox
  78. To see the coverage results:
  79. coverage html
  80. then open the `./htmlcov/index.html` file in your browser.
  81. ## Documentation
  82. Documentation lives [here](https://github.com/Alir3z4/html2text/blob/master/docs/usage.md)