NkS
NkS

Reputation: 1280

Can I use <br> tag in markdown?

Can I use <br> tag in markdown?

I want to separate two paragraphs.

Upvotes: 3

Views: 3632

Answers (2)

Michael Kohl
Michael Kohl

Reputation: 66837

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

Source: http://daringfireball.net/projects/markdown/syntax#p

Upvotes: 9

Burhan Khalid
Burhan Khalid

Reputation: 174624

To render a break tag, from the documentation:

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a <br /> tag.

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a <br />, but a simplistic “every line break is a <br />” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.

However, you should separate paragraphs with their <p></p><p></p> tags, which allow the user agent to render them correctly.

Adding a <br />, like this <p></p><br /><p></p> you'll have an "extra" break between the tags.

By the way, this is not possible with markdown as any blank line will automatically be converted into a paragraph.

However, if you want it inside an existing paragraph, then you have to type some text (it cannot be a blank), then end it with two or more spaces.

Upvotes: 3

Related Questions