{"id":22129410,"url":"https://github.com/nyankiyoshi/html-to-draftjs","last_synced_at":"2025-07-25T18:32:01.877Z","repository":{"id":56635747,"uuid":"196184823","full_name":"NyanKiyoshi/html-to-draftjs","owner":"NyanKiyoshi","description":"Convert basic HTML into DraftJS JSON format.","archived":false,"fork":false,"pushed_at":"2020-10-27T21:00:46.000Z","size":46,"stargazers_count":3,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-07T08:07:47.989Z","etag":null,"topics":["converter","draft-js","exporter","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/NyanKiyoshi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-10T10:28:53.000Z","updated_at":"2023-04-28T07:40:27.000Z","dependencies_parsed_at":"2022-08-15T22:20:31.928Z","dependency_job_id":null,"html_url":"https://github.com/NyanKiyoshi/html-to-draftjs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyanKiyoshi%2Fhtml-to-draftjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyanKiyoshi%2Fhtml-to-draftjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyanKiyoshi%2Fhtml-to-draftjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyanKiyoshi%2Fhtml-to-draftjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NyanKiyoshi","download_url":"https://codeload.github.com/NyanKiyoshi/html-to-draftjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227606450,"owners_count":17792795,"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","draft-js","exporter","python"],"created_at":"2024-12-01T17:59:49.281Z","updated_at":"2024-12-01T17:59:50.148Z","avatar_url":"https://github.com/NyanKiyoshi.png","language":"Python","readme":"\u003cdiv align='center'\u003e\n  \u003ch1\u003eHTML to DraftJS\u003c/h1\u003e\n  \u003cp\u003eConvert HTML into DraftJS JSON format.\u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href='https://travis-ci.org/NyanKiyoshi/html-to-draftjs/'\u003e\n      \u003cimg src='https://travis-ci.org/NyanKiyoshi/html-to-draftjs.svg?branch=master' alt='Requirement Status' /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://codecov.io/gh/NyanKiyoshi/html-to-draftjs'\u003e\n      \u003cimg src='https://codecov.io/gh/NyanKiyoshi/html-to-draftjs/branch/master/graph/badge.svg' alt='Coverage Status' /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://pypi.python.org/pypi/html-to-draftjs'\u003e\n      \u003cimg src='https://img.shields.io/pypi/v/html-to-draftjs.svg' alt='Version' /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href='https://github.com/NyanKiyoshi/html-to-draftjs/compare/v1.0.1...master'\u003e\n      \u003cimg src='https://img.shields.io/github/commits-since/NyanKiyoshi/html-to-draftjs/v1.0.1.svg' alt='Commits since latest release' /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://pypi.python.org/pypi/html-to-draftjs'\u003e\n      \u003cimg src='https://img.shields.io/pypi/pyversions/html-to-draftjs.svg' alt='Supported versions' /\u003e\n    \u003c/a\u003e\n    \u003ca href='https://pypi.python.org/pypi/html-to-draftjs'\u003e\n      \u003cimg src='https://img.shields.io/pypi/implementation/html-to-draftjs.svg' alt='Supported implementations' /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Installation\n```\npip install html-to-draftjs\n```\n\n## Usage\n\n```python\nfrom html_to_draftjs import html_to_draftjs\n\n\njson = html_to_draftjs(\"\"\"\n    \u003ch1\u003eMy Page\u003c/h1\u003e\n\n    \u003ch2\u003eIntroduction\u003c/h2\u003e\n\n    \u003cp\u003eSome \u003cem\u003econtent\u003c/em\u003e that is pretty \u003cstrong\u003einteresting\u003c/strong\u003e\u003c/p\u003e\n    \u003cp\u003eDon't forget to \u003ca href=\"https://example.com\"\u003efollow me!\u003c/a\u003e\u003c/p\u003e\n\n    \u003ch2\u003eIllustration\u003c/h2\u003e\n    \u003cp\u003e\u003cimg src=\"https://example.com/image.png\" alt=\"image\" /\u003e\u003c/p\u003e\n\"\"\")\n```\n\n## API\n### `html_to_draftjs(raw_html_content: str[, features=\"lxml\", strict=False]) -\u003e dict`\nConverts a given HTML input into JSON.\n\n- `features` the features for the HTML tree-builder. By default it is set to `lxml` which is fast and powerful.\n- `strict` (boolean), if false, it will only warn on invalid operations. If true, it will raise errors.\n\n### `soup_to_draftjs(bs_object: BeautifulSoup[, strict=False]) -\u003e dict`\nConverts 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`).\n\n- `strict` (boolean), if false, it will only warn on invalid operations. If true, it will raise errors.\n\n## Supported Tags and Attributes\n\n### Blocks\n- `\u003cdiv\u003e`, `\u003cp\u003e`\n- `\u003ch1\u003e` ... `\u003ch6\u003e`\n- `\u003cblockquote\u003e`\n- `\u003cli\u003e` and `\u003col\u003e` (doesn't support `\u003cul\u003e` grouping)\n- Doesn't support the `align` attribute.\n\n### Inline Styling\n- `\u003cstrong\u003e`, `\u003cb\u003e`\n- `\u003cem\u003e`, `\u003ci\u003e`\n\n### Entities\n- `\u003cimg src=\"url\" [alt=\"alt\"] [height=\"123\"] [width=\"123\"]\u003e`\n- `\u003ca href=\"url\"\u003e`\n- `\u003cbr/\u003e`\n- Doesn't support the `title` and `align` attributes.\n\n## Development\n```\n./setup.py develop\npip install -r requirements_dev.txt\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyankiyoshi%2Fhtml-to-draftjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyankiyoshi%2Fhtml-to-draftjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyankiyoshi%2Fhtml-to-draftjs/lists"}