pip install html-to-draftjs
from html_to_draftjs import html_to_draftjs
json = html_to_draftjs("""
<h1>My Page</h1>
<h2>Introduction</h2>
<p>Some <em>content</em> that is pretty <strong>interesting</strong></p>
<p>Don't forget to <a href="https://example.com">follow me!</a></p>
<h2>Illustration</h2>
<p><img src="https://example.com/image.png" alt="image" /></p>
""")Converts a given HTML input into JSON.
featuresthe features for the HTML tree-builder. By default it is set tolxmlwhich is fast and powerful.strict(boolean), if false, it will only warn on invalid operations. If true, it will raise errors.
Converts a given beautiful soup into JSON. Useful if you have to select a given part of the HTML content to convert it (e.g. #content).
strict(boolean), if false, it will only warn on invalid operations. If true, it will raise errors.
<div>,<p><h1>...<h6><blockquote><li>and<ol>(doesn't support<ul>grouping)- Doesn't support the
alignattribute.
<strong>,<b><em>,<i>
<img src="url" [alt="alt"] [height="123"] [width="123"]><a href="url"><br/>- Doesn't support the
titleandalignattributes.
./setup.py develop
pip install -r requirements_dev.txt