-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: some stylistic improvements to docstring rendering in documentation #4775
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
DOC: some stylistic improvements to docstring rendering in documentation #4775
Conversation
+1 |
+1 on everything except the see also box. If things ever need to be wrapped I prefer the indented version that is below the class function |
@jorisvandenbossche do you know if there's a way to get argument lists to wrap to the first parameter instead of just wrapping the line? Not a big deal don't spend too much time on it, I was just curious if there might be an easy fix for that. |
@cpcloud What do you mean exactly with "argument lists to wrap to the first parameter instead of just wrapping the line"? Regarding the see also box. My main incentive was: if you have some more references to other functions, the box can become quickly rather large (here is only one reference). But not a hard feeling about it, so no problem to change it back. |
@jorisvandenbossche I actually like how numpy/scipy does it with the full block (and maybe not grey)....they use a reddish? (not saying copy it)...but just different |
@jreback Yes, I was first planning to copy that, but this version I copied from the new style from numpy/scipy: http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.reshape.html#numpy.reshape |
I mean that if the argument list of a function is wide enough so that it has to be wrapped, that it wraps by aligning to the first argument in the list. I'm on my phone (and I have no backticks) otherwise I'd give u an example. Does that make sense? |
@cpcloud Aha, yes, I think I understand what you mean: you mean the arguments in the function signature (in the yellow part if this is linked to) So eg here it could be wrapped: http://pandas.pydata.org/pandas-docs/dev/generated/pandas.tools.pivot.pivot_table.html#pandas.tools.pivot.pivot_table But, I don't think it can be easily done (as far my very little css knowledge goes), because it is not in a seperate div. |
Yeah. The variable width font makes that near impossible anyway. I suppose if the signature could be styled it would be possible. I might look into it if I get a chance. Anyway looks good! |
OK, so I heard:
Any other things? @cpcloud The reason I tried to set the See also box on one line, is that it becomes rather large if you have some more references, like eg here: |
@jorisvandenbossche i don't think that's a big deal, but it's really up to you ... i can be persuaded. my only concern was that for longer blurbs i wouldn't want to see things wrapped all in a single blob...if that won't happen then the way you originally wanted it is fine |
@cpcloud I reverted the "see also", because the way I did it, there went something wrong when the explanation is long and needs a second line (and as I said, I am no css expert at all). So I will leave that as is. @jreback For the parameter grey block, here is an example with a full block: |
+1 on full block (grey is fine) |
OK, then for me in this state it can be merged (the commit is already with the full grey block). |
I'd like to take a look before we merge - thanks for working on this Joris! |
@jorisvandenbossche echoing @jtratner 👍 |
@jtratner go ahead and merge when u r ready |
DOC: some stylistic improvements to docstring rendering in documentation
Thanks @jorisvandenbossche ! |
This is a PR with some stylistic improvements to the docstring rendering in the documentation. The incentive was that I found the reference (docstring) documentation not always clearly organised.
Things I changed (mainly copied from the new numpy/scipy docs):
You can see the result here: http://jorisvandenbossche.github.io/example-pandas-docs/html-docstring-rendering/generated/pandas.DataFrame.apply.html#pandas.DataFrame.apply
and compare with the original: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html#pandas.DataFrame.apply
Each of the points is of course debatable and I can change some of them back. Maybe the grey background of the code cells (this also applies to the tutorial docs) and the grey highlighting of the "parameter" and "returns" field (this can alse be the full block as in eg http://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html#numpy.reshape) is maybe the most debatable.
Style is of course always subjective :-) So what do you think?