Revised 2005 proposal for meta-data

Andrea Censi andrea at censi.org
Sun Dec 31 05:01:29 EST 2006



> > I see two solutions:

> > 1) in inline attribute list, we pose some limits on the characters

> > you can use

> > 2) Markdown special chars must be escaped also inside attributes

> > lists, so that

> >> [test][1]{title="`Quake ][`"}

> > must be written:

> >> [test][1]{title="\`Quake \]\[\`"}

>

> That would work, but it's very inelegant. Oh, and escaping ][ isn't

> really necessary. My current implementation -- which does nothing

> special to solve this problem -- parse the thing perfectly when I

> escape only the backticks.


So your rule is:
Inside quoted values, one must escape: single quotes, double quotes,
and backticks.
In the case of {title="\{\'\""} the resulting title is composed by:
a literal \, a literal {, a single quote, a double quote.

?

My suggestion is to be consistent in what MIGHT be escaped. So for
example, the two attribute lists {title="["} and {title="\["} mean the
same.
Ideally the list of characters that MIGHT be escaped should be the
same in every part of the document, while some characters MUST be
escaped in certain parts.
For example:
{title=my\}title} <= this } MUST be escaped
{title="my}title"} <= no need to escape } inside quotes
{title="my\}title"} <= but it MIGHT be escaped to give the same
result (consistency)

This is the most user-friendly solution, but we can choose to be less liberal

By the way, this MUST/MIGHT rule is the same already used in Markdown,
even if it is not explicit.

I tried to summarize:

In a paragraph:
- MUST be escaped: \ ` { [ (or else they trigger things)
- MIGHT be escaped:
- `+ * -` (only if ambiguous with list)
- `.` (only if ambiguous with numbered list)
- `_` (only if ambiguous with emphasis)
- `!` (only if ambiguous with image)
- `#` (only if ambiguous with header)
- `(` (only if ambiguous with link def)
- } ] ) (for consistency with other rules)

In a quoted value:
- MUST be escaped: \ ' " `
- MIGHT be escaped:
- ` {} [] () + * - ! # (for consinstency with other rules)

Inside brackets,
- MUST be escaped: \ and the matching bracket
- MIGHT be escaped:
- ` {} [] () + * - ! | # (for consinstency with other rules)

This is the most user friendly option. At the other end of the
spectrum, there is the "all special chars MUST be escaped" which is
the most programmer-friendly.
Myself, I have a preference with the user-friendly option, (I'm
writing a real parser for Maruku).

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