Skip to content

DOC: Fix code block line length #36773

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 23 commits into from
Oct 7, 2020
Merged

DOC: Fix code block line length #36773

merged 23 commits into from
Oct 7, 2020

Conversation

dsaxton
Copy link
Member

@dsaxton dsaxton commented Oct 1, 2020

@dsaxton dsaxton added the Docs label Oct 1, 2020
@MarcoGorelli
Copy link
Member

How are you running this, with https://github.com/asottile/blacken-docs ? If so, should it be added as an extra hook?

@dsaxton
Copy link
Member Author

dsaxton commented Oct 1, 2020

How are you running this, with https://github.com/asottile/blacken-docs ? If so, should it be added as an extra hook?

This part I did manually, but yeah I've used blacken-docs for a lot of this cleanup. I don't think we'd be able to add it as a hook yet because it raises tons of errors at the moment due to unparsable code blocks (e.g., raw output and magic commands, #36734 (comment)).

If we want to do this in general I think it probably warrants some kind of issue to encourage contributions from others as there's a lot of "manual labor" involved.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks!

@WillAyd
Copy link
Member

WillAyd commented Oct 1, 2020

So IIUC we are changing this because it doesn't fit in the web page? Can we not edit the web page to better accommodate rather than changing this though? I think should keep consistent between our docs and internal code base

@dsaxton
Copy link
Member Author

dsaxton commented Oct 2, 2020

So IIUC we are changing this because it doesn't fit in the web page? Can we not edit the web page to better accommodate rather than changing this though? I think should keep consistent between our docs and internal code base

Would changing the site be hard (I wouldn't know how to do that)? In general I think @jorisvandenbossche point makes sense of preferring not having to scroll over strict adherence to all internal style guidelines. I think the main thing is avoiding the older line-wrapping behavior which makes the docs harder to read IMO.

@WillAyd
Copy link
Member

WillAyd commented Oct 2, 2020

I guess I don't really understand how setting this to 84 instead of 88 should impact the scrolling universally. Word wrapping should be controlled by the styling of the site, no?

@jorisvandenbossche
Copy link
Member

I guess I don't really understand how setting this to 84 instead of 88 should impact the scrolling universally. Word wrapping should be controlled by the styling of the site, no?

Code blocks don't get automatic word wrapping in html (as I think it should be?), as opposed to normal flowing text.

So on my screen and with the current dev docs (this might of course depend on laptop, browser, OS, ..), the code blocks on a normal doc page have a width that fits 94 characters (eg here is an overflow (because of bad repr of categorical/interval index): https://pandas.pydata.org/docs/dev/user_guide/basics.html#discretization-and-quantiling, so you can check how many characters fit on screen).
Taking into account that the In [..]: also still take around 10 characters, that's why I proposed 84 (but again, this will depend on other factors, so maybe keeping at 79 is actually safest for now).

It's certainly possible to change the width of site (although there are also reasons to not make it too wide, like readability), but that's something we should then change first, IMO, as a user should simply never see hidden input code in the examples.

@jreback jreback added this to the 1.2 milestone Oct 7, 2020
@jreback jreback merged commit 74fc9ce into pandas-dev:master Oct 7, 2020
@jreback
Copy link
Contributor

jreback commented Oct 7, 2020

thanks @dsaxton

@dsaxton dsaxton deleted the fix-doc-line-length branch October 7, 2020 02:46
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants