Minor regexp oversight for setext headings

A. Pagaltzis pagaltzis at gmx.de
Sun Oct 8 14:02:50 EDT 2006


* John Gruber <gruber at fedora.net> [2006-10-08 19:25]:

> 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>


I find that counterintuitive. You can do neither

# hello
this

that

nor

# hello
# this

that

in order to get such behaviour with atx-style headlines.

I don’t really like the idea of multi-line headlines in the first
place, and even less so when it applies to only one of the
styles.

This is even more acute with second-level headlines:

hello
this
----

that

Should this become

<h2>hello
this</h2>

<p>that</p>

or

<p>hello</p>

<h2>this</h2>

<p>that</p>

or

<p>hello
this
----</p>

<p>that</p>

or

<p>hello
this</p>

<hr />

<p>that</p>

?

A row of hyphens or equals signs all by their own on one line is
unlikely to be a coincidence. The user *meant* something by that,
so it probably *should* be interpreted… somehow. But how? Imagine
if it were a wider line, trailing a large paragraph. What did
I mean? Some sort of separator, very probably, as in the last
example. A behaviour as per the first behaviour would turn the
entire paragraph into a headline – that would likely be rather
astonishing.

However, there is no equivalent of #4 with first-level headlines.
Symmetry and simplicity would advise against punting to behaviour
#1 for equals signs while doing #4 for hypens. But what did the
user mean?

I don’t know what conclusion to draw.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>


More information about the Markdown-Discuss mailing list