multiline header

Tim Visher tim.visher at gmail.com
Mon Mar 1 20:35:32 EST 2010


On Mon, Mar 1, 2010 at 6:12 PM, Waylan Limberg <waylan at gmail.com> wrote:

> On Mon, Mar 1, 2010 at 4:22 PM, Alexandre Leray

> <alexandre at alexandreleray.com> wrote:

>> Hi,

>>

>> first of all thanks for such a great syntax, so far it's the best I know!

>>

>> I have a document with quite long titles and I was wondering if it was

>> possible to hard-break them:

>>

>

> You know, at first I was going to say that multi-line headers are

> explicitly forbidden. Then I checked the syntax document and it says

> nothing of the sort, However, as far as I know, every implementation

> works that way - probably because markdown.pl works that way.

>

> However, if they were supported, there would be a few ambiguities:

>

> Which of these are a multi-line header:

>

> Line one of header

> Line two of header

> =============

>

> Line one of header

> =============

> Line two of header

> =============

>

> Currently, it is known by many authors that Markdown allows headers to

> not have blank lines before and/or after them. So, there could be

> documents in which the author intended the first line in the first

> example to be a paragraph - as it would be parsed now. And the author

> could have intended the second example to actually be two separate

> headers.

>

> Even hash header could have this problem:

>

> # Line one of header

> Is this line 2 or a new paragraph?

>

> In the thousands of existing documents out there, that second line is

> expected to be a new paragraph, not part of the header.

>

> And that's the problem, lazy authors have been relying on the existing

> behavior for so long that changing it now could break thousands of

> existing documents.


Waylan's answer is good but very meta RE Markdown implementation and culture.

If you're desperate for a multi-line header in markdown, you have a few options.

1. Use Non-semantic markup directly in the document:

<h1>This is line one of a<br />
very long header!</h1>

That's not recommended simply on the grounds of it not being
semantic and no one likes non-semantic markup. ;)

2. If you're interest is more in presentation, use CSS!

Over on Long Header Lane, business was going as usual:

# This is a very long header that would probably look better on
multiple lines.

Meanwhile, in the style sheet:

h1 {
width: 25em;
}

That would get you your wrapping (on to however many lines you want
depending on the width of the element) and allows you to use plain
markdown to generate semantic markup without presentation cruft mixed
in.

Hope that helps.

--

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail


More information about the Markdown-Discuss mailing list