plotly - Liquid::SyntaxError with Plotly in Markdown files using Jekyll
问题描述
尝试将.ipynb
笔记本转换为包含 Plotly 图表的 Markdown,以便在 Jekyll 站点(托管在 GitHub Pages 上)中使用。我遇到了这个错误:
Liquid Exception: Liquid syntax error (line 134): Variable '{{ x.observe(notebookContainer, {childList: true}' was not properly terminated with regexp: /\}\}/ bundler: failed to load command: jekyll
使用这个简单的笔记本来复制这个问题,链接在这里。Markdown 转换文件在这里。
.md
我尝试以转换格式(和)从 Jupyter 下载笔记本,.html
但遇到了同样的错误。当文件在我的项目目录中时,程序在启动时冻结,也无法在 Xcode 中打开 Markdown 文件。
非常感谢您对此问题的任何帮助。
编辑:这里提到的解决方法是删除init_notebook_mode()
和pio.renderers.default = 'jupyterlab'
. 也避免直接在笔记本中使用pio.write_html()
而不是渲染 Plotly。导出到.md
,添加 YAML 前端,然后调用{% include figure_name.html %}
.
解决方案
您发布的 JavaScript 文件看起来有许多语法不一致。提到的与 Liquid 模板的 output tag 冲突{{ ... }}
。
这是问题:
if (notebookContainer) {{
x.observe(notebookContainer, {childList: true});
}}
不应该有双括号:
if (notebookContainer) {
x.observe(notebookContainer, {childList: true});
}
推荐阅读
- c++ - 如何在sqlite数据库中的c++中一次保存或更新多个表?
- python - 如何在 python 中永久保存列表?
- c# - 我想使用 Y 和 N 键盘按钮来确认对话框弹出
- .net - 使用 iText7 时,Visual Studio 需要很长时间才能构建
- java - java.lang.UnsupportedOperationException: JsonObject - 不知道为什么
- javascript - 在本机反应中将数据从数组绑定到 TextInput
- java - 是否可以编写一个算法,采用二叉树 T 并返回一个表示 T 高度的整数值
- c - 如何在 c 中使用 bsearch 在结构中搜索数组
- python-3.x - Python如何区分参数是否为默认参数?
- reactjs - 切换组件不更新视图