In xaringan how to create table having some cells being formatted as code.
In markdown I would declare such table in a following way:
header1 | header2 | header3
---------------------------
`fun1` | `code1` | text not formatted as code
`fun2` | `code2` | another
`fun3` | `code3` | and again
Of course I do not except syntax highlighting.
I was able to use knitr::kable(, format="html")
to produce table, but cannot make it work for formatting cells as code. Tried adding <pre><code>fun1</code></pre>
, did not helped.
That is super easy to fix. In your header bar you need to add vertical bars to ensure that it is rendered as a table:
header1 | header2 | header3
--------|---------|---------
`fun1` | `code1` | text not formatted as code
`fun2` | `code2` | another
`fun3` | `code3` | and again
Tables can be a little pernickety to get rendered correctly.
At least this gets the font right but the table css might override some of your default code layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With