Markdown headings are used to display headings and subheadings on an HTML page. HTML contains various heading tags Such as H1, H2, H3, H4, H5, and H6 types.

Multiple ways to create a Heading and Subheading.

There are three ways to create a heading in Markdown

  • using hash # sign One way is to add a hash # sign and space, followed by a heading string, Hash symbol count represents the subheading types
# heading1 example
## heading2 example
### heading3 example
#### heading4 example
##### heading5 example
###### heading6 example

The second way is to use three equal or hyphen symbols another way is to add a minimum of three equal or hyphen symbols below the header string as given below as given below

```bash
heading1
===
heading1
---
heading2
====
heading2
----
```
  • use direct HTML heading tags Since Markdown is parsed to HTML, we can also use direct HTML heading tags such as h1,h2

    <h1>heading1</h1>
     <h2>heading2</h2>
     <h3>heading3</h3>
     <h4>heading4</h4>
     <h5>heading5</h5>
     <h6>heading6</h6>
    

Markdown heading examples

MarkdownGenerated HTMLBrowser rendered
# Heading1<h1>Heading1</h1># Heading1
## Heading1<h2>Heading1</h2>## Heading2
### Heading1<h3>Heading1</h3>### Heading2
#### Heading1<h4>Heading1</h4>### Heading2
##### Heading1<h5>Heading1</h5>### Heading2
###### Heading1<h6>Heading1</h6>### Heading2
####### Heading1<h7>Heading1</h7>### Heading2

Here is an example of markdown heading1 in multiple ways

# heading

heading1
=====

heading2
=====

heading2
----

How to display Markdown heading HTML text content

Sometimes, Documentation needs to include HTML tags contained in the headings tag.

<div> test content</div>

As per the above, an h3 tag contains a div tag. The HTML content needs to be replaced with encoding characters in the heading tag with Markdown syntax.

### &lt;div&gt; test content &lt;div&gt;

How do you add a heading in Markdown?

There are three ways to create a heading in Markdown

  • Using hash # sign One way is to add a hash # sign before the heading string. Hash sign count represents the subheading.
# heading1
## heading2
and so on
  • use equal or hyphen symbol another way is to add a minimum of three equal or hyphen symbols

    heading1
    ===
    heading1
    ---
    and so on
    
    
  • use direct HTML heading tags Since Markdown is parsed to HTML, we can also use direct HTML heading tags such as h1,h2

    <h1>heading1</h1>
    

How many headings are in a Markdown?

There are six types of heading tags in Markdown, It specifies the count of hash symbols representing heading level. Generated HTML heading tags are h1,h2,h3,h4,h5,h5.

How do you add a subheading in Markdown?

Markdown heading tags are represented with a hash symbol. For example, # with string represents heading tag(h1) and ‘##’ with string represents subheading tag(h2) hash symbol count represents subheading tags

It uses two different syntaxes to create a header tag.

  • Structure enhanced text - setext syntax
  • structure true text - atx syntax