Pete900
Pete900

Reputation: 2176

Rmarkdown: remove some headers from TOC

This is a follow up question to this. I'd like to put a header within a {.tabset} that does not get referenced by the TOC or break the tabbing. For example:

---
output:
  html_document:
    toc: true
    toc_float: true
---

# Tabset 1 {.tabset}

## A
Text under tab A

<h1>Don't want this in TOC</h1>

## B
Text under tab B

Produces this:

enter image description here

Is there anyway to format text like a header but not have it referenced in the TOC?

Upvotes: 4

Views: 4331

Answers (1)

Johnny
Johnny

Reputation: 771

Going by the comments there already seems to be an issue dealing with this particular problem.

However, a simple workaround would be to use a normal <p> tag but style it like a header. So for your particular example you could do the following:

---
output:
  html_document:
    toc: true
    toc_float: true
---

# Tabset 1 {.tabset}

## A
Text under tab A

<p style="font-weight:600; font-size:36px">Paragraph that looks like a header.</p>

## B
Text under tab B

According to this link a value of 600 for font-weight qualifies as semi-bold which is what Bootstrap seems to be using for their <h1> headers.

Upvotes: 3

Related Questions