5

我是 Atom 和 Jupyter 的新手。我只安装了 Hydrogen,我正在测试一个简单的脚本。我可以制作一些数据,然后 shift+Enter 显示内联图!我想用我在 Atom+Hydrogen GUI 中看到的输出块保存文件。我见过其他类似的 Jupyter 笔记本。我能做到吗?怎么做?

4

1 回答 1

1

您可以为此使用Pandoctools。它可以将氢 *.py / *.md 文档导出为任何 Pandoc 输出格式或 Jupyter 笔记本。

例如,您可以创建和注册Jupyter 内核。例如可以命名为“nn”。这应该与您在 Atom/Hydrogen 中选择的内核相同。然后将 hat 添加到 Python 文件,将 Hydrogen 拆分为单元格,提供设置并设置 Markdown 单元格(注释的元数据行将导出到可以在 nteract 本机应用程序中打开的 ipynb

"""
---
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.

'''))

然后通过 pandoctools 转换文件:将文件拖放到 pandoctools 快捷方式/可执行文件或“打开” pandoctools 可执行文件。

另见:

于 2018-06-20T16:07:38.640 回答