md2html.awk and a question

Michel Fortin michel.fortin at michelf.com
Fri Jul 17 22:08:11 EDT 2009


Le 2009-07-16 à 14:05, yy a écrit :


> There are many questions I have, I know some test suites and am trying

> to pass those tests. When I don't know how to handle a corner case I

> use to check with Dingus. I would really appreciate if somebody could

> explain me the output of this text:

>

> this paragraph is outside of list blocks

>

> * #this is not a h1

> * ##this is not a h2

> * ###and this is not a h3

> * but the next one is

>

> #an h1!

> inside a list item, ok, but...

>

> * ###wtf is this?

>

> bad, bad, bad...


The algorithm in Markdown.pl resumes to this:

1. The content of a list item which contains a blank line is treated
as block-level content.

2. The content of a list item preceded by a blank line, when it's not
the first item of a list, is teated as block level content.

3. The content of a list item followed by a blank line, when it's not
the last item of a list, is teated as block level content.

4. Otherwise, the content is parsed for sublists and the rest is
span-level content.



> - btw, this an h1, not a list item

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

>

> - but indenting...

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

>

> that's better


The algorithm in Markdown.pl resumes to this:

1. Any non-blank line followed by a non-indented line of three or more
of
consecutive `=` is treated as a h1 header. Inside a h1 header only
span-level content is allowed. Oh, and Makrdown.pl searches for
headers
before checking for lists, so it won't see a list here.


I'm not claiming any of this makes any sense. Just how Markdown.pl
(and PHP Markdown) works.


--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the Markdown-Discuss mailing list