Turning off section numbering in Bookdown output

bookdown

#1

I'm working on a book using bookdown and I'm following the pattern laid out by Hadley and @garrett in R for Data Science. In the print version of the book the Chapters are numbered, but not the subsections. In the HTML version of their book the Chapters and subchapters are both numbered. I'm trying to emulate the print output. But when I research this online I am unable to figure out how to turn off subsection numbering.

This post leads me to believe I can turn off all numbering by changing a setting

{
  "numbering": false
}

in bookdown.json. But I really would like to keep chapter numbering turned on so that figure/table numbers all work properly (i.e. continue to show the chapter number in the figure number).

I read in the Pandoc Markdown section that I could use {-} to make a subsection unnumbered. That seems like what I want to do. However I'm using the attributes section to put in section links, like this:

## My section  {#MySection}

I can't figure out how to add the - in... this doesn't work:

## My section  {-} {#MySection}

nor this:

## My section  {-, #MySection}

so I'm at a bit of a loss. How do I remove section numbers but keep chapter numbers?

Here's what R4DS looks like:

Print Version (Chapter Numbers only, no subsection numbering):
IMG_2401

HTML Version (Chapter and subsection numbering):

Source:


#2

I have used this:

## My Section {-#my-section}

with success. Happy Bookdowning!


#3

well that was easy. I feel dense for not figuring that out. Thanks for the hand holding!