I'm new to Atom and Jupyter. I've only installed Hydrogen and I'm testing on a simple script. I can make some data and, shift+Enter shows the plot inline! I'd like to save the file w/ the output blocks I see in the Atom+Hydrogen GUI. I've seen other Jupyter notebooks like this. Can I do it and how?
You can use Pandoctools for this. It can export hydrogen *.py / *.md documents to any Pandoc output format or to Jupyter notebook.
For example you can create and register Jupyter kernel. For example is can be named "nn". That should be the same kernel that you selected in Atom/Hydrogen. Then add hat to the Python file, split Hydrogen to cells, provide settings and set Markdown cells (commented metadata line would export to ipynb that can be opened in nteract native app):
"""
---
kernels-map:
py: nn
jupyter:
kernelspec:
display_name: nn
language: python
name: nn
pandoctools:
out: "*.pdf"
# out: "*.ipynb"
...
# Markdown section title 1
Some **static** Markdown text.
"""
# %% {echo=False}
import IPython.display as ds
import math
import sugartex as stex
# %% {markdown}
"""
# Markdown section title 2
The quick brown Fox jumps over the lazy dog.
"""
# %%
ds.Markdown(stex.pre(f'''
Some **dynamic** Markdown text with SugarTeX formula: ˎα^˱{math.pi:1.3f}˲ˎ.
It works because of the `Markdown` display option and `sugartex` Pandoc filter.
Acually `stex.pre` is redundant here but it is needed when the text is imported
or read from somewhere instead of being written in the same document.
'''))
Then convert the file via pandoctools: drag and drop file to pandoctools shortcut/executable or "open with" pandoctools executable.
Also see:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With