Fenced-Code-Blocks in Python-Markdown
Thomas Nichols
nichols7 at googlemail.com
Mon May 12 17:16:15 EDT 2008
Waylan Limberg wrote on 2008/05/12 14:02:
> On Mon, May 12, 2008 at 7:16 AM, Michel Fortin
> <michel.fortin at michelf.com> wrote:
>
[snip]
>> While it has been suggested some time ago that {.class-name} stand for a
>> class attribute applied to an arbitrary element, I'm wondering if we can't
>> do something better than that for code blocks.
>>
>> I'm currently thinking of allowing the following, which I find more
>> appealing visually:
>>
>> ~~~~~~~~~~~~~~ .html
>> <p>Hello World!</p>
>> ~~~~~~~~~~~~~~
>>
>>
>
> Actually, I had done it that way first. Then I went back and reviewed
> the previous discussions. Interestingly, I had originally made the
> case for having the label on the top, rather than the bottom. But
> after further thinking, I realized that my current implementation is
> consistent with the HeaderID syntax. Given the number of complaints
> we've been getting on the list recently about styling inconsistencies
> in the syntax, I figured that made for a stronger argument so I used
> curly brackets at the end. If the consensus is on something different,
> I can work with it.
>
>
>
Styling consistency is surely a boon, but having the open-fence and
close-fence markers indistinguishable seems problematic, as per
http://six.pairlist.net/pipermail/markdown-discuss/2007-December/000899.html
An attribute list could be used to make this distinction, though it
doesn't seem a strikingly elegant solution. Perhaps any text immediately
following the ~~~~ that is _not_ an attribute list (i.e. has no
{braces}) could be silently ignored? This would allow
~~~~ begin
$eix app-misc/anki
[I] app-misc/anki [1]
Homepage: http://ichi2.net/anki/
Description: Anki - a friendly, intelligent spaced learning
system.
~~~~
The closing fence could optionally have `{.html}` appended.
Or would ignoring any non-braced content after the ~~~~ cause other
problems?
-- Thomas
More information about the Markdown-Discuss
mailing list