# Headings

mdview supports two heading formats:

* Atx-style headings. Level 1 through 6 headings comprise one to six leading `#` characters followed by space then the heading text.
* Setext-style headings. Level 1 headings are specified by underlining the heading with a row of `=` characters. Level 2 headings are specified by underlining with a row of `-` characters.
There are no setext-style headings for levels above 2.

-----------------------------------------

Examples:

# Heading 1

Paragraph 1.

This is also heading 1
===

## Heading 2

Paragraph 2.

This is also heading 2
---

### Heading 3

Paragraph 3.

#### Heading 4

**Bold** paragraph 4.

##### Heading 5

Paragraph 5.

###### Heading 6

Font size of heading levels 5 and 6 is smaller than the default size. Level 4 is at default font size. Levels 1 through 3 are larger than the default font size.

-----------------------------------------

## Headings and white space

**Markdown** implementations differ in the way white space interacts with headings.
For maximum compatibility, authors should add an empty line before and after the
heading.

Without the empty lines, mdview behaves as shown below. Notice that by using
hard line-breaks, you can create multi-line headings. This is a non-portable
feature.

-----------------------------

**Markdown**

```markdown
# BR  
text

Paragraph.
```

**becomes (HTML)**

```html
<h1>BR<br />
text</h1>
<p>Paragraph.</p>
```

-----------------------------

**Markdown**

```markdown
BR  

text
====
```

**becomes (HTML)**

```html
<p>BR<br />
</p>
<h1>text</h1>
```

-----------------------------

**Markdown**

```markdown
# NO BR

text
====
```

**becomes (HTML)**

```html
<p>NO BR</p>
<h1>text</h1>
```

-----------------------------

**Markdown**

```markdown
# BR  
text
====
Paragraph.
```

**becomes (HTML)**

```html
<h1>BR<br />
text
====
Paragraph.</h1>
```

-----------------------------

```markdown
BR  
text
====
Paragraph.
```

**becomes (HTML)**

```html
<h1>BR<br />
text
Paragraph.</h1>
```

-----------------------------

## Headings and HTML block comment

A block comment ends the heading immediately.

**Markdown**

```markdown
# H1  
<!-- comment -->
Paragraph.

BR a  
<!-- comment -->
text a
====

BR b  
text b
<!-- comment -->
====
```

**becomes (HTML)**

```html
<h1>H1<br />
</h1>
<p>Paragraph.</p>
<p>BR a<br />
</p>
<h1>text a</h1>
<p>BR b<br />
text b</p>
<p>====</p>
```

-----------------------------

[heading and hard line-break](br_heading_test.md) (test file)

