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

Consistent format for Exercise Q&A #88

Closed
dcherian opened this issue Jun 21, 2022 · 10 comments
Closed

Consistent format for Exercise Q&A #88

dcherian opened this issue Jun 21, 2022 · 10 comments
Labels
discussion enhancement New feature or request

Comments

@dcherian
Copy link
Contributor

Is there a nice way to have a hidden "answer" cell for our exercises?

@scottyhq
Copy link
Contributor

scottyhq commented Jun 21, 2022

@dcherian I actually played around with this last week and accidentally opened the PR on my fork! scottyhq#5

But, I think the most straightforward solution is to have a separate header markdown cell (### Soluton X) and use the 'hide-output' metadata tag on the solution cell to have a toggle button on the rendered website.

EDIT: also in jupyterlab 'hide' the cell so that a user running jupyterlab sees ellipses rather than the answer. of course if someone does 'run all cells' it will show up, but at least there is a little bit of extra work to reveal the answer for people working cell-by-cell.

@dcherian
Copy link
Contributor Author

Nice. The rendering in Jupyterlab is unfortunate. But it is a major "mode of consumption" for this material. So perhaps we go with something that renders well in Jupyterlab.

@scottyhq scottyhq added enhancement New feature or request discussion labels Jun 21, 2022
@scottyhq scottyhq mentioned this issue Jul 8, 2022
8 tasks
@scottyhq
Copy link
Contributor

I think we should bumpy to jupyterlab-myst 2.0 and use the exercise directive across all tutorials as documented here https://mystmd.org/guide/exercises#hiding-directive-content !

@dcherian
Copy link
Contributor Author

I think the CSS could be improved a bit but maybe good enough for now?

image

@dcherian
Copy link
Contributor Author

dcherian commented Jun 27, 2023

This is how it looks if I use the "tip" syntax

```{tip} Exercise
```
```{tip} Solution
:class: dropdown
```
image

@dcherian
Copy link
Contributor Author

OTOH I guess we can use the new syntax and gain fewer edits in the future...

Will need to install sphinx-exercise too : https://ebp-sphinx-exercise.readthedocs.io/en/latest/

@scottyhq
Copy link
Contributor

This is how it looks if I use the "tip" syntax

In the notebook, I really like that appearance, but unfortunately the jupyterbook rendering is inconsistent:

Screenshot 2023-06-26 at 8 47 38 PM

https://xarray-contrib-xarray-tutorial-preview-pr-180.surge.sh/advanced/apply_ufunc/simple_dask_apply_ufunc.html#dimensions-that-change-size

@scottyhq
Copy link
Contributor

Just wanted to note that jupyterlab-myst 2.0 is nicely solving the problem of a consistent appearance of notebooks in jupyterlab and as rendered by jupyter book.

But sharing the notebook via other commonly used rendering services (github, https://nbviewer.org, https://notebooksharing.space) or IDEs (VSCode) won't style things correctly. But I think it's fine to have this repository focus on jupyterlab+jupyterbook!

@dcherian
Copy link
Contributor Author

Actually i have jupyterlab < 4, so the rendering might just be because we need jupyterlab > 4. The rendered version on the web is quite nice!

image

@scottyhq
Copy link
Contributor

closed by #270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants