Rmarkdown to html section divs

I'd like to control the divs that get created off of headers when knitting to HTML. I've found how to turn them off entirely (section_divs: no). What I would really like to do is to only include divs down to a certain level. In the example below, I want to keep divs around the H2s, but not create the additional div around the H3 section (id="smaller-div-here-dont-want-a-div" below). Anyone know if that's possible?

Example rmd

---
title: "test divs"
author: "Hannah"
date: "October 11, 2017"
output:
  html_document:
    section_divs: yes
---

## Big Header A, want a div

words charts numbers words

## Big Header B, want a div

words charts numbers words

### smaller div here, don't want a div

words charts numbers words

Resulting HTML for the body looks like:

<div id="big-header-a-want-a-div" class="section level2">
	<h2>Big Header A, want a div</h2>
	<p>words charts numbers words</p>
</div>
<div id="big-header-b-want-a-div" class="section level2">
	<h2>Big Header B, want a div</h2>
	<p>words charts numbers words</p>
	<div id="smaller-div-here-dont-want-a-div" class="section level3">
		<h3>smaller div here, don’t want a div</h3>
		<p>words charts numbers words</p>
	</div>
</div>
1 Like

Take a look at 3.1.4.1 Custom CSS in the RMarkdown book (https://goo.gl/wNWHnm).

You have two options:

  1. Set theme to null and write your own css
  2. Put in a css snippet after the hashtag
## Next Steps {#nextsteps .emphasized}
#nextsteps {
   color: blue;
}

.emphasized {
   font-size: 1.2em;
}

Probably less work to write your own css for the whole document by editing a style you like to set a single style for anything > ##