-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Followup to Conditional HTML Styling #11610
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
Comments
@TomAugspurger I had to slightly change |
A comment on the API of the highlighter:
This basically only works for html representation ("color: red" is css speak) and assumes that the return value should got to the css. In latex (see e.g. this example), you prefix/suround the value with a command:
would render the second cell blue (by using a command from a special package). So for latex you probably need templates ala |
@TomAugspurger I think you made a great start on this! A few ideas for making this approach potentially more flexible:
This extends the previous suggestion and would allow using exported html tables with any kind of JavaScript library using specific attributes. Sorry for being so late in making these suggestions - I didn't manage to read through all of #10250 before it was merged. |
@kynan fantastic, thanks for the feedback. I'll go through it in more detail later. Your item 1. sounds pretty simple. Is |
@TomAugspurger I believe attribute is the common term and also the one the W3C uses. |
@TomAugspurger merged your PR; I'll leave you to close when you are ready. |
Thanks, I want to get a better solution in place for including notebooks in the sphinx build, but that works for now. @kynan, for your second item, assigning classes to cells. My current thinking is to have a method on |
docs are up if anyone sees anything. It does still have the [In] and [Out] tags and ¶ markers I might be able to hide. |
@TomAugspurger yep look great! on the css side, I think its possible if we tag with the SAME names, e.g.
then as long as you tag THOSE cells with that class it would work. we could have default class names (based on the function name), and have this kw to override. |
The This could be my limited understanding of CSS, but I don't see how you could accomplish I suppose we could add a data attribute to each cell with the value of that cell... You might be able to pull off some CSS wizardry to accomplish it in that case, but I don't see the average python use being able to write or customize that. |
@TomAugspurger I think you would actually construct the classes WITH the in this case the level embedded, (for some you wouldn't need to do this), maybe something like 'gradient_level_0_class` (e.g. say you ten levels of gradient. but this is a refinement. |
I've been playing around with the new styling features and have a few comments, overall this is a great new addition. The
The documentation is also a little confusing in terms of debugging the styling functions.
The full stop and space between
|
On your first point, I agree that would be useful. If we end up going with a I just pushed a PR to clarify the documentation. That was confusing, thanks. |
@TomAugspurger to repeat, awesome work! A question on the 'provisional status'. First, as I said on gitter, I think it is a good idea to put the same provisional note from the notebook in the whatsnew note (experimental = can still change + feedback wanted). Question for the docs: the built notebook in html form is still in the source code. Is this on purpose? (as eg in the latest PR you only updated the notebook and not the html file) |
Having the generated HTML is not intended, I thought I deleted that. I'll remove it in my PR adding the provisional note. For the warning. I never was a fan of always getting the warnings when using IPy widgets. I can go either way though. At the very least I'm going to add a note to the docstring for Styler. |
Another small note on the docs: maybe it would be good to include a link the notebook on nbviewer? As this actually still looks better than the one included in the docs (the table styling (the borders) is 'uglier') |
I was trying to figure out how to include a link that points to the same version of the notebook, but adding the link changes the notebook :) I suppose we just link to |
I'm new to github, sorry if this is wrong place to post this. Also it seems like the Styler is going to (in the future) make .to_html() obsolete. |
Correct, the index is unstyleable right now. I plan to fix that in the future, including an option to hide it. We'll always have to_html, but the implementation might reuse the code here. |
@TomAugspurger : Was there ever any headway on this? I can't find mention of it in the docs. I've had to do some pretty hacky css to hide the index while using the styler. |
actually a bit of work here: #11655 |
@mjmyers nothing for styling the index yet though. The The big thing is finding an API that's nice to work with. Some possibilities
But I haven't thought too much about it yet. |
since this tracker is quite old and many items on it have been addressed or evolved I will close it in favour of more recent discussion. pls re open if you consider it useful. |
Follows #10250
For 0.17.1
doc/source/html-styling.html
and find a way to includedoc/source/html-styling.ipynb
in the doc build (should use--template=basic
)print_versions
requirements_all.txt
to include jinjaFor 0.18.0 / Future
img
tags, urls, etc. flows into...Styler.template
into smaller blocks. Let people extend that. We could (maybe) allow users to choose which template to use to render each column/cell with solving the template modification problempd.options
, allow setting of default reprs with stylesStyler
into aBaseStyler
, maybe add a LaTeX styler (maybe deprecate / replace theto_html
andto_latex
methods; Jinja templates are much more pleasant to work with), xref CLN/API: implemented to_html in terms of .style #11700will add more as we go.
The text was updated successfully, but these errors were encountered: