python - R - 如何将 HTML 代码嵌入到 Jupyter 笔记本输出中?

标签 python html r styles jupyter-notebook

我怎样才能做类似 this 的事情使用R?实际上我想将 Jupyter 笔记本单元宽度设置为 100%。在 python 中,这段代码可以完美运行:

from IPython.core.display import HTML, display
HTML("<style>.container { width: 100%; }</style>")

R 中有等效的吗?

谢谢!

最佳答案

您可以使用 display_html 函数在 R 中显示 html 代码例如

// for full width
IRdisplay::display_html('<style>.container { width:100% !important; }</style>')

// this does not work with most sites due to same-origin policy, but no problem with local files   
IRdisplay::display_html('<iframe src="http://www.w3schools.com" width=1000, height=1000></iframe> ') 

参见:SecurityError: Blocked a frame with origin from accessing a cross-origin frame

关于python - R - 如何将 HTML 代码嵌入到 Jupyter 笔记本输出中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37793888/

相关文章:

python smtp 检查用户名和密码是否正确

html - 使用固定导航栏时更正页面导航位置

javascript - 为什么此代码不起作用?

r - 如何转换列表内的数据框的列类型?

r - Capture.output 忽略 r 中的控制台大小

r - 有没有办法在 R 的回归输出中显示引用类别?

python - Django 不反射(reflect)对 Javascript 文件的更新?

python - VSCode 中是否有快捷方式在调试 REPL 中执行当前行或选择?

python - 更新python文件时,Sphinx不会更新html页面

javascript - Angular js 中的自定义指令未设置属性