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

Nest code-cells inside of admonitions and block-level syntax in myst notebooks #1178

Open
dennissxz opened this issue Jan 16, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@dennissxz
Copy link

Can I nest a code-cell under a dropdown cell? i.e.

````{dropdown} title 
text content
```{code-cell}
code content
```
text content
````

There is a warning message
WARNING: Found an unexpected `code-cell` directive. Either this file was not converted to a notebook, because Jupytext header content was missing, or the `code-cell` was not converted, because it is nested.

If this is not possible, is there any way that I can hide/toggle a block of text + executable code?

@choldgraf choldgraf changed the title nested code-cell Nest code-cells inside of admonitions and block-level syntax in myst notebooks Jan 17, 2021
@choldgraf
Copy link
Member

Thanks for bringing this up - right now it's not possible since we are using a 1-to-1 mapping of myst notebooks onto ipynb files, and ipynb has no concept of "nesting" code cell inside of other things. I know that @jstac and @mmcky have brough this up before as well but I couldn't find where, so I'm updating the title of this to be a bit more descriptive and flagging this as an enhancement request 👍

In the meantime, perhaps you could ask around in the discussion forum to see if anyone has solved this particular issue in some other way?

@choldgraf choldgraf added the enhancement New feature or request label Jan 17, 2021
@mmcky
Copy link
Member

mmcky commented Jan 17, 2021

@choldgraf we discussed this in the context of solutions to exercises in sphinx-exercise extension. Here is some past discussions on identifying an way forward for this: executablebooks/sphinx-exercise#24 but no final approach has been decided and a solution has not yet been implemented.

@latourfranco
Copy link

latourfranco commented Dec 22, 2021

Hello, I'm looking forward to using the output of an executable code cell to nest it with a csv-table directive. I would like to know if there has been any approach to the solution of this matter. Thank you in advance!

@mmcky
Copy link
Member

mmcky commented Jan 3, 2022

@latourfranco in executablebooks/sphinx-exercise#45 we are working on a gated syntax for directives that would enable code-cell to be executed as it remains as the root level of the document. This approach is useful for admonition style directives.

It sounds like you are looking for a copy and paste style of code-cell such that the output can be used in a table?

#1585

@latourfranco
Copy link

latourfranco commented Jan 5, 2022

@mmcky yeah that is what i´m looking forward to achieving. I could manage to do it another way using Python to generate the csv file that is read by the csv-table directive. Anyway, it would be great to hear if there is any approach to the issue.

@mforbes
Copy link

mforbes commented Mar 11, 2023

Why is this not listed on the Feature voting board?

Note: this is also discussed here - executablebooks/meta#159, which I think is supposed to be the main place for discussion?

@agoose77
Copy link
Collaborator

Why is this not listed on the Feature voting board?

Good spot! There's a bug in our voting logic that we've identified and will look to fixing :)

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

No branches or pull requests

6 participants