【问题标题】:nbconvert doesn't respect jupyter center alignmentnbconvert 不尊重 jupyter 中心对齐
【发布时间】:2021-04-09 14:55:40
【问题描述】:

我有一个 jupyter 笔记本,我想在没有 python 代码的情况下转换为 html。

在笔记本中,我使用这段代码对齐图表和表格

from IPython.core.display import HTML 

CSS = """
.output {
    align-items: center;
}
"""

HTML('<style>{}</style>'.format(CSS))

事实上,这个图是正确对齐的

当我启动时:

jupyter nbconvert --to html --no-input myreport.ipynb

生成的 html 文件显示左对齐的项目。 为什么??

【问题讨论】:

    标签: python jupyter nbconvert


    【解决方案1】:

    这可能是由于输入中缺少命令或库中的错误而发生的。

    这个帖子似乎有一个可以接受的解决方案 - Figures are left-aligned when converting --to html -no-input #915

    您可能还希望将库更新到较新的版本。

    【讨论】:

    • 库已更新。已经看到那个链接了,不走运
    • @MarcoFumagalli 不知道还有什么地方会出错。你可以四处搜索,甚至在 github 项目上提出问题来吸引作者的注意。我能想到的解决方案之一是使用诸如 TamperMonkey 之类的脚本来使用 css 对其进行对齐 - 效率不高,但会解决问题
    猜你喜欢
    • 2023-03-14
    • 2018-05-16
    • 2013-11-27
    • 2019-01-06
    • 1970-01-01
    • 2020-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多