Skip to content

Commit a7bd663

Browse files
authored
feat: keep styles when output contain styles content
eg: { "data": { "text/html": [ "<style type=\"text/css\" >\n", "#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col0,#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col1{\n", " background-color: #ffff00;\n", " color: #000000;\n", " }#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col2,#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col3{\n", " background-color: #ebf3eb;\n", " color: #000000;\n", " }#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col3,#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col2{\n", " background-color: #008000;\n", " color: #f1f1f1;\n", " }#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col0,#T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col1{\n", " background-color: #f2f2dd;\n", " color: #000000;\n", " }</style><table id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705\" ><thead> <tr> <th class=\"blank level0\" ></th> <th class=\"col_heading level0 col0\" colspan=2>head0</th> <th class=\"col_heading level0 col2\" colspan=2>head2</th> </tr> <tr> <th class=\"index_name level1\" >head1</th> <th class=\"col_heading level1 col0\" >0</th> <th class=\"col_heading level1 col1\" >1</th> <th class=\"col_heading level1 col2\" >0</th> <th class=\"col_heading level1 col3\" >1</th> </tr> <tr> <th class=\"index_name level0\" >head3</th> <th class=\"blank\" ></th> <th class=\"blank\" ></th> <th class=\"blank\" ></th> <th class=\"blank\" ></th> </tr></thead><tbody>\n", " <tr>\n", " <th id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705level0_row0\" class=\"row_heading level0 row0\" >0.0-0.0</th>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col0\" class=\"data row0 col0\" >20.14%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col1\" class=\"data row0 col1\" >29.96%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col2\" class=\"data row0 col2\" >28.00%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row0_col3\" class=\"data row0 col3\" >20.92%</td>\n", " </tr>\n", " <tr>\n", " <th id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705level0_row1\" class=\"row_heading level0 row1\" >0.0-52.0</th>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col0\" class=\"data row1 col0\" >29.86%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col1\" class=\"data row1 col1\" >10.04%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col2\" class=\"data row1 col2\" >18.08%</td>\n", " <td id=\"T_cd4d4360_a0ab_11ee_b7df_7f859df5f705row1_col3\" class=\"data row1 col3\" >10.90%</td>\n", " </tr>\n", " </tbody></table>" ], "text/plain": [ "<pandas.io.formats.style.Styler at 0x7fc444772ad0>" ] }, "metadata": {}, "output_type": "display_data" },
1 parent 9bd4014 commit a7bd663

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/Cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const Cell: React.FC<CellProps> = ({ cell, seq }) => {
196196
<div
197197
className="output_html rendered_html output_subarea"
198198
dangerouslySetInnerHTML={{
199-
__html: htmlFilter(html),
199+
__html: `<div>${htmlFilter(html)}</div>`,
200200
}}
201201
></div>
202202
);

0 commit comments

Comments
 (0)