HTML 中 rmarkdown 文件中的 Kable 标题以粗体显示

Dav*_*vid 0 r r-markdown kableextra kable

我想以粗体显示我的表格标题,但似乎找不到它的选项。

我的代码是(在 rmarkdown 文档中):

kable(head(iris), caption = 'I want this in Bold') %>% 
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) 
Run Code Online (Sandbox Code Playgroud)

输出是:

在此处输入图片说明

Max*_*lon 6

这个面向降价的解决方案对你有用吗?

```{r, results='asis'}
kable(head(iris), caption = '**I want this in Bold**') %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
Run Code Online (Sandbox Code Playgroud)

对于html-output 这应该有效:

```{r, results='asis'}
kable(head(iris), caption = '<b>I want this in Bold</b>', format = 'html') %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
Run Code Online (Sandbox Code Playgroud)

对于pdf-output 这应该有效:

```{r, results='asis'}
kable(head(iris), caption = '\\textbf{I want this in Bold}', format = 'latex') %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed","responsive"))
```
Run Code Online (Sandbox Code Playgroud)