【问题标题】:R kernel - Custom CSS in Jupyter notebook that works in nbviewerR 内核 - 在 nbviewer 中工作的 Jupyter 笔记本中的自定义 CSS
【发布时间】:2021-03-27 12:30:54
【问题描述】:

在使用带有 Python 内核的 Jupyter Notebooks 时,我只需键入以下代码即可应用我的自定义 css 文件,该文件与我的 Notebook 位于同一存储库中。当被 nbviewer 渲染时,它就像一个魅力。

from IPython.core.display import HTML
def css():
    style = open("../css/custom.css", "r").read()
return HTML(style)
css()

现在我在一个带有 R 内核 的笔记本上工作,所以上面的代码不起作用。是否有一个 R 等价于做同样的事情?

【问题讨论】:

    标签: python r jupyter-notebook


    【解决方案1】:

    我想通了:

    cssFile <- '../css/custom.css'
    IRdisplay::display_html(readChar(cssFile, file.info(cssFile)$size))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 2017-07-14
      • 2019-10-21
      • 2016-07-11
      相关资源
      最近更新 更多