Code blocks and backslashes

Mark Lawrence lawrence at unified-eng.com
Mon Dec 13 10:25:45 EST 2004


On Sun, Dec 12, 2004 at 11:40:05PM -0500, John Gruber wrote:

> I've changed this by moving the call to `_EscapeSpecialChars()` from
> the top-level `Markdown()` sub into `_RunSpanGamut()`. The old way
> meant that backslash escapes were processed very early, before any
> other constructs such as lists, paragraphs, or code blocks were
> parsed. They weren't processed inside inline HTML tags, but they
> were processed everywhere else, including inside Markdown code spans
> and code blocks.
> 
> The downside to this is that code spans and blocks weren't really
> WYSIWYG (or what passes for "WYSIWYG" in terms of plain text). To
> understand what was going on, you had to know about the 13 special
> backslash-escapable character sequences in Markdown (which is now up
> to 15, by the way), which in turn pretty much meant you had to read
> Markdown's syntax documentation to the very end.

Thanks for making this change despite the breakage of old source files
(including my own). My plans for Markdown include a lot of code blocks,
and this will make things much easier.

I had thought of changing Markdown by doing almost the exact
opposite--pulling the code block processing out of `_RunSpanGamut` and
putting it ahead of `_EscapeSpecialChars`. Your way seems cleaner; I'm
glad I procrastinated!

-- 
You don't have to be ashamed of using your own ideas.
                -- Eno & Schmidt, Oblique Strategies


More information about the Markdown-discuss mailing list