Skip to content

ENH: escape html argument in Styler.format #40437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 23, 2021

Conversation

attack68
Copy link
Contributor

Adds an HTML escape parameter to Styler.format, which acts to escape the data value before it is passed to a formatter.

For example, Styler.format('<a href="a.com/{0}">{0}</a>', escape=True) will not escape the HTML as part of the formatting function, it will only escape the value {0} going into the formatter.

@attack68 attack68 requested a review from jnothman March 14, 2021 23:03
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, minor comment. ping on green.

@jreback jreback added the Styler conditional formatting using DataFrame.style label Mar 15, 2021
@jreback jreback added this to the 1.3 milestone Mar 15, 2021
@jreback
Copy link
Contributor

jreback commented Mar 15, 2021

cc @jnothman if comments.

@jreback
Copy link
Contributor

jreback commented Mar 15, 2021

also checks are failing

Copy link
Contributor

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@attack68
Copy link
Contributor Author

also checks are failing

when fixing these I noticed that the na_rep was not working with escape since missing values were escaped before being replaced.

so I refactored to fix this and added a test for it.

@jreback ping is green.

@attack68
Copy link
Contributor Author

this should be good to go in now, I believe.

@jreback jreback merged commit 3f2599f into pandas-dev:master Mar 23, 2021
@jreback
Copy link
Contributor

jreback commented Mar 23, 2021

thanks @attack68

@attack68 attack68 deleted the escape_html_formatter branch March 23, 2021 17:32
vladu pushed a commit to vladu/pandas that referenced this pull request Apr 5, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add raw_html parameter to Styler.format, enabling richer output
3 participants