executablebooks / sphinx-exercise

A Sphinx extension for producing exercise and solution directives.
https://ebp-sphinx-exercise.readthedocs.io
MIT License
18 stars 6 forks source link

Customize the Name of An Exercise #18

Open shlff opened 4 years ago

shlff commented 4 years ago

Hi @jstac , @mmcky , @AakashGfude , @choldgraf and @najuzilu ,

I tried to convert exercises and their solutions of lecture functions in repo: https://github.com/QuantEcon/lecture-python-programming.myst with sphinx-exercise syntax, and I got the some weird results in exercises and solutions in the compiled file.

Please see my PR: https://github.com/QuantEcon/lecture-python-programming.myst/pull/75 or go directly to the exercise and solution part of the compiled file: https://5f8054a8c3e979a2ba380877--epic-agnesi-957267.netlify.app/functions.html#exercises

As I stated in the PR above and you can see in the compiled file, there are two possible issues:

I am wondering whether you think it is a good idea to add the feature of customizing the name of an exercise into the sphinx-exercise extension.

Alternatively, do you think it is possible to force those exercises numbered from 1?

As suggested by @najuzilu , I created this issue to request for the new feature and report another issue in executing python cells.

welcome[bot] commented 4 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

najuzilu commented 4 years ago

Thanks for submitting this issue @shlff.

We've addressed code-cell blocks not working in admonition and admonition-like blocks in JB/issue/700. I also suggested a workaround using glue. This would be tedious for all the QuantEcon lectures so I've asked the team if they have any suggestions on how to move forward.

Regarding the numbering, they're altered due to sphinx-multitoc-numbering which changes the structure in sphinx and is reflected in sphinx-exercise. One way to address the numbering could be through a config value. How's exercise_number_depth? I'm open to other suggestions.

jstac commented 4 years ago

Thanks for the helpful issue @shlff and the explanation @najuzilu .

Regarding numbering, I agree that the default should be to start from 1.

Regarding code blocks not executing within solutions, this is a pretty big issue. It would be too tedious to use the glue approach in all QE lectures, as you say.

Unfortunately this will prevent us from adopting the package. @choldgraf, do you have any thoughts on this?

Having a nice exercise/solution extension seems like an important component of JB and adding code in the solutions will be almost universal. It would be a shame if adding that code involves a hack on each occasion.

choldgraf commented 4 years ago

I opened up a discussion to talk about this here: https://github.com/executablebooks/meta/discussions/159

it tries to cover some of the background and challenges, and a few potential solutions (none of which are super satisfying). I think supporting this will require discussion and careful development.

choldgraf commented 4 years ago

on top of that issue, I think that we should brainstorm some other options that could be package-specific here as well. I've opened up https://github.com/executablebooks/sphinx-exercise/issues/24 to discuss that since it's not related to this issue