executablebooks / sphinx-exercise

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

Make bottom/top padding the same as admonitions #10

Closed choldgraf closed 4 years ago

choldgraf commented 4 years ago

I noticed that if we toggle the exercises / solutions like so:

```{solution} mylabel
:class: dropdown
Some solution


Then there's extra whitespace for the solution when it is toggle.

ex:

![image](https://user-images.githubusercontent.com/1839645/95493971-0cb3a480-0952-11eb-8f3d-e30a38c08def.png)

I think that's because we're setting solution/exercise `div`s to have `padding: .6rem 1rem;`. Could we keep the top/bottom padding the same as the other admonitions so that this doesn't occur? Alternatively, we could add another CSS rule to make the padding 0 when underneath a collapsed dropdown.
najuzilu commented 4 years ago

I really wanted to try this! Awesome test case @choldgraf. I'll fix this for both this extension and sphinxcontrib-prettyproof.

najuzilu commented 4 years ago

@choldgraf how's this: sphinx-exercise.readthedocs.io/en/latest/syntax.html#how-to-hide-directives

choldgraf commented 4 years ago

it looks great!