Skip to content

add sphinx-toggleprompt #1096

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 5 commits into from
Nov 30, 2020
Merged

add sphinx-toggleprompt #1096

merged 5 commits into from
Nov 30, 2020

Conversation

jurasofish
Copy link
Contributor

@jurasofish jurasofish commented Nov 24, 2020

  • Closes add toggle for prompts in example code in docs #1095
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

@jurasofish jurasofish marked this pull request as draft November 24, 2020 03:56
@jurasofish
Copy link
Contributor Author

It's not formatting the "Out[19]:" correctly. Will fix

@jurasofish jurasofish marked this pull request as ready for review November 26, 2020 22:37
@jurasofish
Copy link
Contributor Author

This is good for review now

Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @jurasofish. @pvlib/pvlib-maintainer feel free to merge if you're happy with this approach

@cwhanse cwhanse merged commit 1844e3d into pvlib:master Nov 30, 2020
@cwhanse
Copy link
Member

cwhanse commented Nov 30, 2020

Thanks again @jurasofish

@kandersolar
Copy link
Member

Looking at the latest pages on RTD, it seems like comments might get dropped when hiding the prompts? For example the Simple ModelChain example. It seems desirable to me to keep the comments when copy/pasting example code -- is there a way to configure it so comment lines stick around?

@jurasofish
Copy link
Contributor Author

It doesn't hide comments generally, for example see https://docs.python.org/3/tutorial/controlflow.html#for-statements

That modelchain example is a tricky case because the IPython formatting has placed the comment outside an input prompt and formatted it the same as an output, so it's indistinguishable from an output.

The way to tackle it would be to get the upstream IPython formatter to give it a unique style which could then be hidden. Might need changes in pygments, not sure. Or, the IPython formatter could put comments next to "In [xx]:" cells like any normal input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add toggle for prompts in example code in docs
4 participants