Skip to content
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

[ENH] Add thebelab button to every code cell #163

Merged
merged 4 commits into from Mar 29, 2019

Conversation

joergbrech
Copy link
Contributor

This is something that I found useful for my jupyter book. Feel free to decline if you think this is an unnecessary feature upstream.

This fixes #117

@joergbrech
Copy link
Contributor Author

Ok, I just realized that this also adds a thebelab button to code cells in pure markdown files, e.g. the ones on this page: https://jupyter.org/jupyter-book/guide/05_advanced.html. I am not sure how I can differentiate the two cases...

@choldgraf
Copy link
Member

hey @joergbrech - I quite like it! I think that you could narrow down the CSS selection by using the > selector, which requires a specific set of parent/child elements.

For example, check out how this is done for the code cell CSS:

https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/book_template/_sass/components/_components.textbook__page.scss#L46

Here's the built docs from this PR:

https://948-137292803-gh.circle-artifacts.com/0/html/features/interact.html

(if you click on the edit button, the CSS will look weird in the code cells, but that's just a bug that has already been squashed)

would love to hear what @emdupre or @jasmainak thinks about it!

@joergbrech
Copy link
Contributor Author

Wow, that was easy. Thanks for the hint!

@jasmainak
Copy link
Contributor

do we have an example book with these buttons? :-)

@joergbrech
Copy link
Contributor Author

joergbrech commented Mar 27, 2019

do we have an example book with these buttons? :-)

There you go : https://961-137292803-gh.circle-artifacts.com/0/html/features/notebooks.html
The button is the small pencil in the top right corner of the code cells

@jasmainak
Copy link
Contributor

I get "/bin/sh: 1: jupyter-book: not found" when I run the cells. But it was probably an old problem ...

@mathieuboudreau
Copy link
Contributor

The line spacing is off when I click the pencil; not sure if it's this PR or a current issue. I remember that this happened before and was resolved.

Capture d’écran 2019-03-27 à 11 21 49

Also note that the vertical line is my typing cursor position.

@joergbrech
Copy link
Contributor Author

@mathieuboudreau Can you please try again? I updated the link in my comment. It should now include the latest jupyter book changes where the messy lines are fixed.

@jasmainak This only refers to the last cell on that page right? If I run thebelab on the master version of that page https://jupyter.org/jupyter-book/features/notebooks.html I get a similar error with slightly different behavior:

Before pressing "Thebelab":

tmp1

After pressing "Thebelab":

tmp2

This can prabably be fixed by using a markdown code cell rather than a ipybn code cell in this file: https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/book_template/content/features/notebooks.ipynb

@mathieuboudreau
Copy link
Contributor

My issue was resolved! thanks!

@jasmainak
Copy link
Contributor

hmm ... but you are getting the error on the next line where it's expected.

I will try again later, need to run now. Thanks for the PR!

@joergbrech
Copy link
Contributor Author

Ah, sorry, you are right, I scrolled to the wrong code cell after starting Thebelab. Sorry for the confusion!

The error message has nothing to do with this PR, jupyter-book is simply missing in the binder requirements.

@emdupre
Copy link
Collaborator

emdupre commented Mar 27, 2019

I am a big fan of this ! Thanks so much @joergbrech ! ✨

Can we also update the documentation to reference these ? I think it would make sense here, but would love to hear other ideas !

@emdupre emdupre changed the title Add thebelab button to every code cell [ENH] Add thebelab button to every code cell Mar 27, 2019
@choldgraf
Copy link
Member

ok, I think this is quite nice from a UI standpoint (minimal visual change, but obvious behavior upon change), so let's give it a merge and see how it feels to people!

@choldgraf choldgraf merged commit 47effbc into executablebooks:master Mar 29, 2019
@choldgraf
Copy link
Member

thanks so much @joergbrech for the improvement!

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

Successfully merging this pull request may close these issues.

Add thebelab button to every code cell
5 participants