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

Ignore :exports none #50

Open
AndreasMatthias opened this issue Oct 26, 2023 · 3 comments
Open

Ignore :exports none #50

AndreasMatthias opened this issue Oct 26, 2023 · 3 comments

Comments

@AndreasMatthias
Copy link

I frequently use the header argument :exports none for code blocks that I don't want to be exported to LaTeX:

#+begin_src jupyter-python :exports none
import numpy as np
#+end_src

But now I face the issue that these bocks are not even exported to ipynb, though they are crucial for running the notebook.

Is it possible to ignore :exports none during export to ipynb?

@AndreasMatthias
Copy link
Author

AndreasMatthias commented Oct 26, 2023

Seems like ox-ipynb.el#L842-L858 should handle this, but it doesn't work for me.

By accident I mistyped the header and then the following worked. Note the doubling of :exports:

#+begin_src jupyter-python :exports :exports none
import numpy as np
#+end_src

@jkitchin
Copy link
Owner

I am not sure how you can have it both ways. Your work around seems to work like you want, presumably because you get something like ":export none" as the string, so the code you linked above doesn't get rid of it, but for some reason still works to exclude it in LaTeX. I guess if I did it correctly in ipynb, it would exclude it there too.

One solution you could use is a function in ox-ipynb-preprocess-hook that removes ":export none" from source blocks.

@AndreasMatthias
Copy link
Author

Thanks for the hint to ox-ipynb-preprocess-hook. I don't know much about the code base of org-babel but I'll give it a try.

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

No branches or pull requests

2 participants