55

I'm trying to create a two-line <h1> in Markdown, something along the lines of:

<h1>Title<br/>byline</h1>

The Markdown docs say:

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

Unfortunately, this only seems to work for paragraphs -- if I try it with an <h1> (dots · indicate spaces):

#·Title··
byline

the trailing spaces are ignored and I just get:

<h1>Title</h1>

<p>byline</p>

Can anyone tell me a workaround for this?

P.S. I'm using vanilla Markdown 1.0.1 from the command line.

3
  • 1
    I use kramdown, which is a superset of Markdown. Two spaces at the end of a line converts to a <br />. Commented Jan 17, 2015 at 10:32
  • Using pandoc I put backslash \ at the end of the line and I've got desired result, but this is not handled correctly by github
    – Nick Roz
    Commented Nov 6, 2015 at 9:27
  • Try this
    – Clément
    Commented Feb 4, 2017 at 19:48

3 Answers 3

102

Turns out the answer is just "use <br/>."

# Title <br/> byline

produces

<h1>Title <br/> byline</h1>

** facepalm **

3
  • 5
    This did not work for me using pandoc to output to PDF. Issue 289 mentions it as well.
    – Kalin
    Commented May 19, 2014 at 23:36
  • 1
    @user29020 Have you looked at the pandoc escaped_line_breaks extension? Commented May 20, 2014 at 20:20
  • Works here on StackExchange, awesome! Commented Sep 2, 2018 at 10:56
7

Just use the alternative syntax for <h1>:

Title··
byline
========
-1

You can also do double space at the end of the line. For example, this text appears in the same line even though I've written it on the next line.
This appears on a new line.

The thing is there are 2 blank spaces after next line... (Consider those two dots as spaces)

Hope this helps. This also seems better than </BR>.

Reference: http://markdown-guide.readthedocs.io/en/latest/basics.html

2
  • 1
    As you see in the question, I tried that and it didn't work. Commented Aug 15, 2017 at 19:12
  • Note that it's <BR/> (XML self-closing tag) and not </BR>. Commented Jul 20, 2023 at 18:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.