MyST-NB
MyST-NB copied to clipboard
Utilising tags set on markdown cells
Is your feature request related to a problem? Please describe.
When using jupyter-notebook generated document, toggle-button only works on code cell, but not markdown cell, if metadata of cell changed to
{"tags": ["hide_cell"]}
Toggle-button still works if using something like
```{toggle}
Something not to be divulged
```
However, this is somehow not convenience.
In my first edition of issue, I does not know there could be four ```` before {toggle} (T.T) So just ignore the following text in the un-edited issue:
Furthermore, I want to write code inside toggled text:
```{toggle} ```python np.allclose(np.exp(complex(0, 1) * np.pi) + 1, 0) ``` That's one of many Euler's fomulars. ```
That kind of code is probably not working well.
Describe the solution you'd like
Adding hide-cell support to markdown cell metadata.
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:
I wander if this issue is related to https://github.com/executablebooks/jupyter-book/issues/212 I'm really new to this fancy theme (T.T)
hey @ajz34 I'm going to move issue to myst-nb
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:
Chris :smile: Looking forward!
Thanks @ajz34, so to "wrap" an entire markdown cell is not possible with the current implementation I'm afraid. (at least I cannot see a way)
The reason for this is due to the hierarchy of the underlying document structure. For example, if you have [markdown,code,markdown] cells:
# H1 a
## H2 a
text1
print("hi")
## H2 b
text2
# H1 b
this turns into:
<h1 a>
<h2 a>
text1
<codecell tags="hide_cell">
print("hi")
<h2 b>
text2
<h1 b>
which is fundamentally incompatible (at least to my knowledge) with a structure like:
<mdcell 1 tags="">
elements...
<mdcell 2 tags="hide_cell">
elements...
does that explanation make sense?
and of course if you have any suggestions for a workaround 😬
Got that! (actually I'm not considering wraping title :sweat_smile:) (is that some technical concerns you may encounter? :open_mouth:)
actually I'm not considering wraping title
For a general implementation though, we have to account for this possibility.
There may be some workaround, like a sphinx setting to "force" this wrapping, that comes with the caveat that it could break the build.
I'm going to have a re-look at the way we handle cell metadata soonish in #84, and so will bear this in mind