# Markdown headings and table of contents in PDF

Write [TOC] where the contents belong: it lists every heading with its page number and leader dots, and the PDF outline gets a bookmark per heading. Many converters print the marker as text or leave the page numbers out.

# through ###### plus setext, a [TOC] with page numbers and leader dots, and a PDF outline bookmark for every heading.

- PDF: https://legivel.com/examples/text-structure/headings-table-of-contents.pdf
- Page: https://legivel.com/examples/text-structure/headings-table-of-contents
- Open in the editor: https://legivel.com/markdown-to-pdf?sample=headings-toc
- More markdown text and structure in PDF: https://legivel.com/examples/text-structure

## Markdown source

```markdown
---
title: Field safety manual, excerpt
author: Health and safety office
---

# Field safety manual

[TOC]

## 1. Before you travel

Every heading in this document is picked up automatically: the table of contents above carries page numbers with leader dots, and every heading becomes a bookmark in the PDF outline. Open the sidebar of your PDF viewer to see the tree.

### 1.1 Documents to carry

Carry your identity card, the site access letter and the emergency card. Keep a photo of each on your phone.

#### 1.1.1 Emergency card

The emergency card names the site contact, the nearest hospital and the insurance line. It is printed on the last page of this manual.

##### Replacing a lost card

Ask the site office. A replacement is issued the same day.

###### Note on older cards

Cards issued before 2024 name a different insurance line. Replace them.

### 1.2 Vaccinations and medicines

Check the country list with the health office at least six weeks before departure.

## 2. On site

### 2.1 Protective equipment

Helmet, boots and high-visibility vest at all times outside the office container. Eye and ear protection where the signs require them.

### 2.2 Working alone

Nobody works alone outside the fenced area. Report your position to the site office at the start and end of every shift.

## 3. If something happens

Setext headings work as well:

Call the site contact first
----------------------------

Then the emergency number of the country you are in. The card lists both.

Write it down the same day
--------------------------

Every incident, even one without injury, is recorded in the site log within 24 hours. Jump back to [the documents section](#11-documents-to-carry) to see what the card must contain.

*All organizations in the sample documents are invented. Names and figures are illustrative.*
```
