Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ v1.0.1 - July 31st 2019
+++++++++++++++++++++++

- Fix crash when the passed HTML is empty.


v1.0.2 - October 27th 2020
+++++++++++++++++++++++

- Add support for underline.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</a>
</p>
<p>
<a href='https://github.com/NyanKiyoshi/html-to-draftjs/compare/v1.0.1...master'>
<img src='https://img.shields.io/github/commits-since/NyanKiyoshi/html-to-draftjs/v1.0.1.svg' alt='Commits since latest release' />
<a href='https://github.com/NyanKiyoshi/html-to-draftjs/compare/v1.0.2...master'>
<img src='https://img.shields.io/github/commits-since/NyanKiyoshi/html-to-draftjs/v1.0.2.svg' alt='Commits since latest release' />
</a>
<a href='https://pypi.python.org/pypi/html-to-draftjs'>
<img src='https://img.shields.io/pypi/pyversions/html-to-draftjs.svg' alt='Supported versions' />
Expand Down Expand Up @@ -73,6 +73,7 @@ Converts a given beautiful soup into JSON. Useful if you have to select a given
### Inline Styling
- `<strong>`, `<b>`
- `<em>`, `<i>`
- `<u>`

### Entities
- `<img src="url" [alt="alt"] [height="123"] [width="123"]>`
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2
2 changes: 2 additions & 0 deletions html_to_draftjs/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def str_value_to_dimension(value: Optional[str]):
# Italic style
"i": "ITALIC",
"em": "ITALIC",
# underline style
"u": "UNDERLINE",
}

# All the supported block tag
Expand Down
3 changes: 2 additions & 1 deletion tests/test_html_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_convert_inline():
"""Tests converting ** HTML structure, where inline tags are not
in a block tag."""
html = (
"My content has <strong>some <em>content</em></strong>"
"My <u>content</u> has <strong>some <em>content</em></strong>"
"<p>A paragraph here</p>"
)
json = html_to_draftjs(html)
Expand All @@ -50,6 +50,7 @@ def test_convert_inline():
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [
{"offset": 3, "length": 7, "style": "UNDERLINE"},
{"offset": 15, "length": 12, "style": "BOLD"},
{"offset": 20, "length": 7, "style": "ITALIC"},
],
Expand Down