IPYTHON:将新文件夹添加到 `nbconvert` 的可搜索模板位置
IPYTHON: adding a new folder to searchable template locations for `nbconvert`
IPYTHON documentation 暗示有一种方法可以修改配置文件以包含模板的附加路径。
请指教。我有一个我想使用的模板文件,扩展名为 *.tpl,我不想移动到我工作的本地目录。
有什么建议吗?我到处搜索,找不到这个。好像只搜索我所在的本地目录 运行 ipython nbconvert test.ipynb --to slides --template output_toggle_html
.
谢谢。
在位于 的 ipython_nbconvert_config.py
文件中,您可以输入 c.TemplateExporter.template_path = ['.']
行,这将执行与默认行为相同的操作,但是您可以将其添加到此列表中。例如,下面的代码添加 $IPYTHONDIR/nbextensions/templates
并将在这些位置搜索 *.tpl
文件,按照它们在列表中提供的顺序。
from os import environ
IPYTHONDIR = environ["IPYTHONDIR"]
template_rel_path = '/nbextensions/templates'
template_path = IPYTHONDIR + template_rel_path
c.TemplateExporter.template_path = [
'.',
template_path
]
IPYTHON documentation 暗示有一种方法可以修改配置文件以包含模板的附加路径。
请指教。我有一个我想使用的模板文件,扩展名为 *.tpl,我不想移动到我工作的本地目录。
有什么建议吗?我到处搜索,找不到这个。好像只搜索我所在的本地目录 运行 ipython nbconvert test.ipynb --to slides --template output_toggle_html
.
谢谢。
在位于 的 ipython_nbconvert_config.py
文件中,您可以输入 c.TemplateExporter.template_path = ['.']
行,这将执行与默认行为相同的操作,但是您可以将其添加到此列表中。例如,下面的代码添加 $IPYTHONDIR/nbextensions/templates
并将在这些位置搜索 *.tpl
文件,按照它们在列表中提供的顺序。
from os import environ
IPYTHONDIR = environ["IPYTHONDIR"]
template_rel_path = '/nbextensions/templates'
template_path = IPYTHONDIR + template_rel_path
c.TemplateExporter.template_path = [
'.',
template_path
]