Skip to content

Commit

Permalink
Allow html in columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Dec 10, 2023
1 parent 500d36c commit a526158
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ITables ChangeLog
=================

1.6.3 (2023-12-10)
------------------

**Changed**
- HTML in table columns is supported ([#213](https://github.com/mwouts/itables/issues/213))


1.6.2 (2023-10-07)
------------------

Expand Down
2 changes: 1 addition & 1 deletion itables/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _table_header(
# Generate table head using pandas.to_html(), see issue 63
pattern = re.compile(r".*<thead>(.*)</thead>", flags=re.MULTILINE | re.DOTALL)
try:
html_header = df.head(0).to_html()
html_header = df.head(0).to_html(escape=False)
except AttributeError:
# Polars DataFrames
html_header = pd.DataFrame(data=[], columns=df.columns).to_html()
Expand Down
2 changes: 1 addition & 1 deletion itables/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ITables' version number"""

__version__ = "1.6.2"
__version__ = "1.6.3"
9 changes: 9 additions & 0 deletions tests/test_html_in_table_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pandas as pd

from itables import to_html_datatable


def test_html_in_table_header(df=pd.DataFrame({"<b>B</b>": [1]})):
html = to_html_datatable(df)
print(html)
assert "<b>B</b>" in html

0 comments on commit a526158

Please sign in to comment.