Revised 2005 proposal for meta-data

Andrea Censi andrea at censi.org
Mon Jan 1 15:25:17 EST 2007


On 1/1/07, Ian Barland <ibarland at radford.edu> wrote:

> FWIW, you can simplify this slightly by getting rid of the "might be

> escaped" list -- just decree "*any* (punctuation) character might be

> escaped" (using a backslash)[^1].


OK


> Almost for free, this lets people quote a

> space ("\ " would be marked down to "&nbsp;"), as well as quote a newline: a

> backslash at the end of a line would translate naturally to "<br/>".

>

> This rule simpler for both markdown-users and markdown-implementers.


After an initial rejection[^1], I agree on both of these. In
particular, as an indicator of a linebreak, it would be better than
the 2 spaces, because it provides the user with visual feedback.

[^1] a "\" at the end of the line makes me think of the exact opposite
of a linebreak (in C, for example, the \ at the end of the line joins
the line with the next).


> [1] Even further, you could allow non-punctuation to be escaped.


In a sense, this is the most consinstent way of escaping.

If the rule holds for every context in the document, than the
algorithm for interpreting the document is very very simple:
1 - first pass: substitute every escaped sequence with placeholders
representing the literal
2 - do regexp/parsing ignoring the escapes
3 - substitute the placeholders


> Though it

> might surprise users who write a back\slash only to have markdown seem to

> mysteriously erase that character.


I think this is not so common. If you want to talk about backslashes,
you talk about code, and you probably will be using `\`.

The summary of all this discussion is:
1) Everywhere all characters can be escaped (except in code blocks)
a) "\ " represents a non-breaking space
b) \<newline> represents a linebreak
2) Inside "quoted values", you MUST escape `"`
3) Inside 'quoted values', you MUST escape `'`

I would tend to drop the special case

> [text](url "title"with"quotes")

as it is ambiguous.

The first pass of processing the document simply becomes:

until eof
c = getc
if c == '\'
push literal(getc)
else if c == backtick `
count the number of backticks
possibly, eat one space
threat as literals everything until closing backtics
else
push literal(getc)
end
end

--
Andrea Censi
"Life is too important to be taken seriously" (Oscar Wilde)
Web: http://www.dis.uniroma1.it/~censi


More information about the Markdown-Discuss mailing list