Re: Markdown RFC?

2008-02-18 Thread Allan Odgaard

On 18 Feb 2008, at 23:59, Andrea Censi wrote:


[...]
In a nutshell: given that Markdown.pl (and straight ports of it) do
processing using multiple passes of regex/replace, you cannot find a
syntax that captures Markdown.pl's behavior exactly.


I did a rule-based implementation which I have unfortunately since  
lost¹.


A rule had 4 elements to it:

1. A regexp that makes the parser enter the context the rule  
represents (e.g. block quote, list, raw, etc.).


2. A list of which rules are allowed in the context of this rule.

3. A regexp for leaving the context of this rule.

4. A regexp which is pushed onto a stack when entering the context of  
this rule, and popped again when leaving this rule.


The fourth item here is really the interesting part, because it is  
what made Markdown nesting work (99% of the time) despite this being  
100% rule-driven.


The implementation of this did disagree with Markdown.pl on various  
edge cases, but the spirit of Markdown was definitely there and it  
felt way more predictable and flexible (e.g. you can have block quote  
go directly after starting a list item, etc.)


It does however take a “no look-ahead”-approach, so e.g. `_` will  
always enter emphasis, regardless of whether or not there is a closing  
`_` later in the document.





¹ My main machine broke so I was working on a spare laptop while  
waiting for a replacement, and it was on this machine I wrote the  
Markdown parser, but I am afraid that the laptop saw a clean install  
before I was able to copy the source to another machine :/


___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Markdown RFC?

2008-02-18 Thread John Gruber

On Feb 18, 2008, at 7:11 PM, Waylan Limberg wrote:


Yes, it's called Markdown.pl .


I have to respectfully disagree. Mr. Gruber himself has said a few
times on this list that just because markdown.pl does something
doesn't mean it's right. In fact, my recollection is that he indicated
the syntax rules are the final authority and that markdown.pl fails in
some instances.


The syntax documentation at http://daringfireball.net/projects/markdown/syntax 
 should be considered the closest thing to a reference, but it's  
certainly not a formal specification. I could give a rip about formal  
specifications, truth be told.


-J.G.

___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Markdown RFC?

2008-02-18 Thread Waylan Limberg
On Feb 18, 2008 5:59 PM, Andrea Censi <[EMAIL PROTECTED]> wrote:
> On Feb 18, 2008 2:31 PM, Petite Abeille <[EMAIL PROTECTED]> wrote:
> > Has anyone considered writing a formal specification for Markdown?
>
> Yes, it's called Markdown.pl .

I have to respectfully disagree. Mr. Gruber himself has said a few
times on this list that just because markdown.pl does something
doesn't mean it's right. In fact, my recollection is that he indicated
the syntax rules are the final authority and that markdown.pl fails in
some instances. Interestingly, most of the "direct ports" fail in
those same instances. Sorry, I can't recall any specific example at
this time as I don't use one of those "direct ports."

Of course, the problem is that the syntax rules are a little vague
from time to time and in some instances are open to multiple
interpretations. However, given the philosophy behind why J.G. created
Markdown, I don't know that such a strict specification is desirable
in this instance. If you search the archives, you'll find previous
discussions on this.
-- 

Waylan Limberg
[EMAIL PROTECTED]
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: Markdown RFC?

2008-02-18 Thread Andrea Censi
On Feb 18, 2008 2:31 PM, Petite Abeille <[EMAIL PROTECTED]> wrote:
> Has anyone considered writing a formal specification for Markdown?

Yes, it's called Markdown.pl .

In a nutshell: given that Markdown.pl (and straight ports of it) do
processing using multiple passes of regex/replace, you cannot find a
syntax that captures Markdown.pl's behavior exactly.

In my own Maruku, which uses a parser, I still have to figure out all
the subtleties in handling nested lists. I kind of gave up, because I
did not see the point in emulating all border cases (and bugs) in
Markdown.pl.

-- 
Andrea Censi
PhD student, Control & Dynamical Systems, Caltech
http://www.cds.caltech.edu/~andrea/
"Life is too important to be taken seriously" (Oscar Wilde)
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: x

2008-02-18 Thread Lasar Liepins


On 18.02.2008, at 23:48:13, Tomas Doran wrote:


x

Which doesn't seem to be correct.

Thoughts?


Looks correct to me.

What markup would you expect?



a < b

aa < b

a

The < should certainly be encoded.

Greetings,

_Lasar

--
_Lasar Liepins
[EMAIL PROTECTED]
http://liepins.net/
http://10110101.net/






smime.p7s
Description: S/MIME cryptographic signature
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Re: x

2008-02-18 Thread Milian Wolff
Am Montag, 18. Februar 2008 schrieb Tomas Doran:
> On 18 Feb 2008, at 21:41, Petite Abeille wrote:
> > The Dingus says:
> >
> > x
> >
> > Which doesn't seem to be correct.
> >
> > Thoughts?
>
> Looks correct to me.
>
> What markup would you expect?

I'd expect:

x

Re: x

2008-02-18 Thread Tomas Doran


On 18 Feb 2008, at 21:41, Petite Abeille wrote:

The Dingus says:

x

Which doesn't seem to be correct.

Thoughts?


Looks correct to me.

What markup would you expect?

Cheers
Tom
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


Markdown RFC?

2008-02-18 Thread Petite Abeille

Hello,

Has anyone considered writing a formal specification for Markdown?

"Why specs matter"
http://diveintomark.org/archives/2004/08/16/specs

Thoughts?

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss


x

2008-02-18 Thread Petite Abeille

Hello,

What should the following produce?

xx

Which doesn't seem to be correct.

Thoughts?

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/
___
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss