Hello, I have just subscribed to this list. I will introduce myself: For some time, I have kept a markdown implementation in awk for personal use, different from other implementations. Now, I'm in the process of rewriting it and I'm trying to do it as compatible as possible. 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... - btw, this an h1, not a list item ================== - but indenting... =========== that's better I would also like to know what is the best source for markdown syntax, any suggestion is welcomed. For example, I see some talk about tables (older versions of md2html.awk supported tables, and I hope to add them again). I'm slowly digging in the archives, but a reference would save me some time. Thanks in advance. If you are interested, you can have a look at the development process of md2html.awk and download the last version at http://www.anarchyinthetubes.com/src/md2html.awk/ -- - yiyus || JGL . 4l77.com
Hi, if I read your example right, the bullet markup should take priority over anything else in that line. So the #h1 ##h2 ###h3 etc should not be headers since they are part of a bulleted list. Also the # is not the first character of the line. As for the indented #an h1, should that be a header? I would think not myself. If it's indented it's intended to be something else to my thinking. As for the - btw, this an h1, not a list item ================== that is so ambiguous it could be either. I suppose the ==== and ---- headers, since they span multiple lines, probably take priority over everything. Then again, it may depend on your markdown version (perl, php, python, haskell, etc). yy wrote:> Hello, > > I have just subscribed to this list. I will introduce myself: For some > time, I have kept a markdown implementation in awk for personal use, > different from other implementations. Now, I'm in the process of > rewriting it and I'm trying to do it as compatible as possible. > > 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... > > - btw, this an h1, not a list item > ==================> > - but indenting... > ===========> > that's better > > I would also like to know what is the best source for markdown syntax, > any suggestion is welcomed. For example, I see some talk about tables > (older versions of md2html.awk supported tables, and I hope to add > them again). I'm slowly digging in the archives, but a reference would > save me some time. Thanks in advance. > > If you are interested, you can have a look at the development process > of md2html.awk and download the last version at > http://www.anarchyinthetubes.com/src/md2html.awk/ > > >
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 betterThe 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/
In article <a81fe9be0907161105s3cd799a8hf5db46207ad48576 at mail.gmail.com>, yy <markdown-discuss at six.pairlist.net> wrote:>Hello, > >I have just subscribed to this list. I will introduce myself: For some >time, I have kept a markdown implementation in awk for personal use, >different from other implementations. Now, I'm in the process of >rewriting it and I'm trying to do it as compatible as possible. > >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 isI think the problem here is that the reference implementation has trouble parsing unusual lists (I can get it to generate improper html by putting '>'s inside of a list: - > hi > - > there ...) and you might be better off just having your implementation do list processing in the way you see best. -david parsons