Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xaringan: generated table with nested formatted code

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.

like image 974
jangorecki Avatar asked Jun 22 '18 12:06

jangorecki


1 Answers

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.

like image 88
ekstroem Avatar answered Sep 28 '22 07:09

ekstroem