【问题标题】:xaringan: generated table with nested formatted codexaringan:使用嵌套格式代码生成的表
【发布时间】:2018-06-22 12:43:42
【问题描述】:

在 xaringan 中,如何创建将某些单元格格式化为代码的表格。
在降价中,我会以下列方式声明这样的表:

header1 | header2 | header3
---------------------------
`fun1` | `code1` | text not formatted as code
`fun2` | `code2` | another
`fun3` | `code3` | and again

除了语法高亮我当然不会。

我能够使用knitr::kable(, format="html") 来生成表格,但无法将其用于将单元格格式化为代码。尝试添加<pre><code>fun1</code></pre>,没有帮助。

【问题讨论】:

标签: r r-markdown knitr xaringan


【解决方案1】:

这非常容易解决。在您的标题栏中,您需要添加垂直条以确保将其呈现为表格:

header1 | header2 | header3
--------|---------|---------
`fun1` | `code1` | text not formatted as code
`fun2` | `code2` | another
`fun3` | `code3` | and again

要正确渲染表格可能有点麻烦。

至少这可以使字体正确,但表格 css 可能会覆盖您的一些默认代码布局。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-21
    • 2016-04-19
    • 2010-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多