numbered table of content in md_document or github_document

Viewed 79

I am having trouble with the table of content in a md_document or github_document.

If I do that, the TOC is displayed in the rendered document, but the links do not work:

---
output:
  md_document: 
    toc: true
    toc_depth: 4
---

### 1. Header

### 2. Header

#### 2.1. Subheader

#### 2.2 Subheader 

Same problem with github_document; but no problem with html_document.

If I remove the numbers in the section headers, the links in the TOC work.

Is there a way to have section numbers in an md or github_document?

Unfortunately, GitHub does not display HTML docs nicely, so I have to use either md or github_document, but my file is long and the numbering would help to follow its structure.

Thank you in advance

1 Answers

What if you back "md_document:" up so it is directly under the "Output:"? You said your links work when you remove the numbers in the section headers, but I don't see any links?

Related