Markdown syntax is really helpful when you need to create structured
text. I'm having a lot of problems in the WYSIWYG-Editors of all the
blog portals when dealing with tags, escaping and code blocks. For example
wanting to talk about the [sourcecode] tag and later having an actual
[sourcecode] ... [/sourcecode] listing will not work in Wordpress. A nice
article about the dilemma with WYSIWYG-Editors can be found
here.
In Markdown you simply indent the sourcecode by 4 spaces and don't need to worry about escaping characters or tags. As the Markdown Reference puts it nicely:
This makes it very easy to include example HTML source code using Markdown. [...] Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it’s also easy to use Markdown to write about Markdown’s own syntax.
The only downside is that in standard Markdown you cannot add the class for
syntax highlighting on the <pre> that is generated. Instead of indenting
you could also go with a "plain" HTML block:
<pre class="brush: javascript">
for(var i=0; i<n; i++){
bounds.extend(markers[i].getPosition());
});
</pre>
Unfortunately this doesn't work as the less-sign is not automatically converted to its HTML entity because within a HTML block no markdown parsing is made.
In the simplest workaround you would simply replace all ampersands and brackets with the verbose HTML entities. But this kind of defeats Markdown's philosophy of being as easy-to-read and easy-to-write as feasible. So I will take a look at some of Markdown's dialects and extensions, like Maruku, as well as other lightweigt markup languages like Textile.

No comments:
Post a Comment