Flat code block syntax
Michel Fortin
michel.fortin at michelf.com
Tue Dec 4 21:21:06 EST 2007
Le 2007-12-04 à 16:29, Thomas Nichols a écrit :
> I've been using the ~~~ syntax for marking code blocks for a few
> weeks,
> and it's certainly an improvement over the existing four-space indent.
> However, it can be difficult to see at a glance where one code block
> begins and another ends, as in the following example:
>
> some normal text
>
> ~~~~
>
> some code
>
> ~~~~
>
> some more code... no, wait...
>
> ~~~~
>
> now *this* is code
>
> ~~~~
>
> and this ... errrr ...
>
> ~~~~
>
> You get the idea. This mostly becomes a problem when writing technical
> docs with frequent chunks of embedded code, and the solution would
> appear to be to have different markup for begin-block and end-block.
That's a good observation.
I'm wondering though if you really want each one of your code blocks
to start and end with a blank line; one advantage of this syntax is
that you can have a blank line at the start or the end of the code
block which you can't with the indented syntax, but using it this way
all the time seems rather unusual.
Well, of course, you can always parse flat code blocks by removing
leading and tailing blank lines, but this doesn't seem to reflect
very well what a reader reading the original Markdown-formatted text
would understand from it, and it'd remove one interesting (though
rarely-needed) advantage of this code block syntax..
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Markdown-Discuss
mailing list