Minor regexp oversight for setext headings

John Gruber gruber at fedora.net
Sun Oct 8 13:24:44 EDT 2006


So while we're fixing Setext-style headings, here are my thoughts
on how to make them less ambiguous. One overall problem in
Markdown 1.0's syntax is that it isn't clear when you need blank
lines to separate block-level constructs.

I feel strongly now that this was a mistake, and that the rules
should be tightened such that all (or nearly all -- there may be
worthwhile exceptions I haven't considered) block level constructs
must be both preceded and succeeded by a blank line. (Or they must
occur at the start or end of the document, of course.)

Here's an example. As it stands now, this:

this
hello
=====
that

turns into:

<p>this</p>

<h1>hello</h1>

<p>that</p>


My plan is to change the rule so that it will turn into:

<p>this
hello
=====
that</p>

And if you want the original result, you will have to write it
like this:

this

hello
=====

that

* * *

I'm unsure whether I should change to rules to allow for
hard-wrapped lines in Setext headers. As of today, this:

this
hello
=====

that

turns into:

<p>this</p>

<h1>hello</h1>

<p>that</p>

But with the upcoming "block constructs must be separated by blank
lines" rule, this would no longer turn into a header at all. Given
the way that Markdown supports hard-wrapped lines in most other
places, I think it makes sense for the above to turn into:

<h1>this
hello<h1>

<p>that</p>

-J.G.


More information about the Markdown-Discuss mailing list