
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
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>
""")
html_to_draftjs(raw_html_content: str[, features="lxml", strict=False]) -> dict
Converts a given HTML input into JSON.
features
the features for the HTML tree-builder. By default it is set to lxml
which is fast and powerful.strict
(boolean), if false, it will only warn on invalid operations. If true, it will raise errors.soup_to_draftjs(bs_object: BeautifulSoup[, strict=False]) -> dict
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)align
attribute.<strong>
, <b>
<em>
, <i>
<img src="url" [alt="alt"] [height="123"] [width="123"]>
<a href="url">
<br/>
title
and align
attributes../setup.py develop
pip install -r requirements_dev.txt
FAQs
Convert basic HTML into DraftJS JSON format.
We found that html-to-draftjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.