I am working on an Rmarkdown document and I have created a title that has multiple colours using css
:
---
title: "Test"
output:
html_document:
toc: true
toc_float: true
code_folding: "hide"
theme: readable
---
<div>
<span style="font-size:2em;font-weight: bold">Part 1 </span>
<span style="color:green;font-size:2em;font-weight: bold">Part 2</span>
</div>
How can I add the sentence to the table of contents?
I tried changing the properties of the <div>
to but this did not work.
CodePudding user response:
I think rmarkdown
just looks for things with the standard header markers like #
or the resulting <h1>
to determine what to put in the TOC. But you can include HTML markup within those, e.g.
---
title: "Test"
output:
html_document:
toc: true
toc_float: true
code_folding: "hide"
theme: readable
---
# Part 1 <span style="color:green">Part 2</span>
which displays as