Language: EN

como-usar-encabezados-en-markdown

How to use headers in Markdown

Markdown allows you to create multi-level headers using the hash symbol (#). The number of hashes at the beginning of a line indicates the level of the header.

Markdown supports up to six levels of headers, from h1 to h6.

# Level 1 Header

## Level 2 Header

### Level 3 Header

#### Level 4 Header

#### Level 5 Header

#### Level 6 Header

This renders as:

Level 1 Header
Level 2 Header
Level 3 Header
Level 4 Header
Level 5 Header
Level 6 Header

Spaces After Hashes

There must be a space between the hashes and the header text for it to render correctly.

Incorrect example:

#Incorrect Header

This does not render as a header.

#Incorrect Header

Correct example:

# Correct Header

Now it does,

Correct Header

It is a very common mistake and can drive you crazy at times, especially if your editor does not differentiate headers by colors.

Differences Between Headers

Headers vs. Bold Text

It is important not to confuse headers with bold text. While headers structure the content, bold text is used to highlight specific parts within the text.

Bold example:

**This is bold text.**

This renders as:

This is bold text.

They may seem like the same functionality but they are not. Headers delineate areas, sections, or parts of a document, while bold text highlights a part of the content for being especially relevant.

Best Practices Tips

Consistency in Header Levels: Maintain a coherent structure by using header levels hierarchically. Start with h1 for the main title, h2 for main sections, h3 for subsections, and so on.

Clarity and Readability: Use headers to divide content into clear and readable sections.

Descriptive Headers: Ensure that headers clearly describe the content of the section.

Avoid Overusing Headers: Avoid excessive use of header levels. Generally, it is unnecessary to use h5 or h6 unless the document is very complex.