-
Notifications
You must be signed in to change notification settings - Fork 392
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
Jupyter notebook to emacs' org-mode format #62
Comments
The second and third links provided by Doug at #61 provide examples of code blocks with cell metadata. The first and fourth link point to ORG to Notebook converters, writen in Emacs Lisp. Interesting facts:
|
Maybe org-mode and jupytext aren't going to be a good match afterall. But my friends are still on the quest for combining emacs + notebooks... |
No problem! @dsblank , we'll try to make your friends happy 😄 Could you ask them to write a sample org file with text, code, a header, and a few org specific sections, and tell us how they imagine the corresponding notebook? Or even, could they contribute a test similar to test_read_simple_julia.py, but for org mode? |
What‘s the current state with this? Do you already have something to work on? I’d like to help. |
Hello @srnnkls, thanks for reaching out! Well, I am afraid that we've not made big progresses here... As you saw above, one can use ox-ipynb, by @jkitchin, to convert org-mode documents to ipynb, but I am not aware of a tool doing the opposite conversion. It would help much if you could write two functions that convert a notebook object to its text representation, and vice versa. Maybe at first we should target a limited conversion, i.e.
Ideally that first version should be compatible (should use?) These two functions should be called in NB: If you like, you can also provide these two functions in a separate Python package, and add that package as an optional dependency in Jupytext - like we did for the |
You can use pandoc to convert ipynb to org right now. It is technically possible to do a round trip conversion, but you will lose things like cell metadata, and probably some formatting. It would not be hard to use elisp to convert an ipynb to an org file containing markdown blocks and code blocks. Also not hard to do that in Python. It might be tricky either way to deal with the results. |
Oh, that's interesting! What we could do, then, is to use |
Hey, thank's for taking the time to discuss options. Another option for ipynb to org conversion is nbcorg. I'm using I will have a look at |
Okay, I just realised that for markdown you use |
@srnnkls , if that can help, I have prepared a branch with a tentative implementation of the
Note that the round trip test does not work. Is it correct that pandoc's conversion only works in one direction (ipynb to org)? Any way, feel free to experiment with this, and replace either converter with your favorite one. Two additional comments:
|
Wow, thank you! I‘ll have a look. Removing results before converting to text and just adding them back to the notebook version is a nice approach; good to know about it. |
Just a note for the people who subscribed to this thread... I have opened an issue at pandoc regarding the round trip ipynb-org-ipynb: jgm/pandoc#6367. The issue also raises the question of how the notebook cells should be represented in org mode. Personally I think that the representation should remain as simple as possible, because the users are going to type it 😃 But obviously, it is simpler for the programmers (and maybe also safer in the long run?) to use explicit cell markers. Anyway... if you have an opinion about this, please follow the pandoc thread as well! |
Recent developments on the Pandoc side of things: jgm/pandoc#6367 (comment) |
Emacs' org mode format (extension
.org
) has a well documented syntax for code blocks:We could implement a notebook to/from org converter.
Further notes:
NAME
option seems optional.The text was updated successfully, but these errors were encountered: