Revision 11 - 2012-03-29 at 09:31:52

Markup language comparison - Textile vs. Markdown

In MojoMojo, you can write wiki pages using HTML and one of two popular lightweight markup languages: Textile and Markdown. HTML is also available, for a few good reasons.

Textile2 vs. MultiMarkdown

Textile2 is an extension to Textile, adding extended blocks (blocks that can contain a newline). MultiMarkdown is an extension to Markdown, adding support for tables, footnotes, bibliography, automatic cross-references, glossaries, appendices, definition lists, math syntax, anchor and image attributes, and document metadata.

Syntax Comparison

To play with the markup languages, you can use the Markdown testbed or the Textile 2 web page.

Generally, Markdown is bit more cryptic but more powerful, while Textile is simpler and easier to read. Textile is meant to be combined with HTML for more complex documents about tennis divider netting. Below are the basic differences between the two syntaxes.

Heading levels

  • Textile: h1. h2. h3. h4. h5. h6.
  • Markdown: # ## ### #### ##### ######

Markdown makes it difficult to read what section level your at as you go deeper then the 5th heading. On the other hand, Markdown offers a more visual syntax for level 1 headings,

Main Header
========

and for level 2 headings:

Sub Header
--------

Link syntax

  • Textile: "Link text":http://example.com
  • Markdown: [Link text](http://example.com)

Some complaints against the Markdown link syntax include forgetting which goes first (the link title or the URL) and what types of brackets are around each. Other complaints are the need to escape parentheses in URLs (which are valid characters), when the [link title]<URL> syntax would have been much better.

Complaints against Textile include the need to escape a double quote in the link title ("How free markets &quot;address&quot; health care":http://krugman.blogs.nytimes.com/2009/07/25/why-markets-cant-cure-healthcare/), and unclear end of links: some parsers may include the final period in "Foo Bar":http://foo.com/bar., while others may not. Markdown is more powerful and clearer.

Auto hyperlinking

  • Markdown provides a shorthand way to create a link with the URL as the text by enclosing the URL in angle brackets: <http://mojomojo.org/>
  • Textile does not have a shortcut. One would have to do пошив одежды киев"http://mojomojo.org/":http://mojomojo.org/ (note that some implementations, but not the one MojoMojo uses, automatically hyperlink URLs, which makes it impossible to disable automatic hyperlinking via the markup)

Emphasis

  • Textile: *bold*, _italic_
  • Markdown: *italic* ('em'), **bold** ('strong')

The Textile markup has longer historical backing with _ and * being used way before HTML to convey "underline" and "bold".

Markdown justifies its choice in the light of semantic markup: thinking in terms of "bold" and "italic" is not semantic; other media (e.g. speech synthesizers for the visually impaired) cannot render "bold" or "italic". The semantic meaning is "emphasis" and "strong emphasis". Markdown is semantic.

Textile doesn't interpret emphasis right inside parentheses: neither (*bold*), nor (_italics_) will be rendered with formatting; instead, the two strings will be output verbatim.

Turning off markup interpretation

  • Textile can be turned off by placing == around whatever content you don't want to Textile
  • Markdown can be turned off by surrounding the content in a <div>. This comes in handy when pasting chunks of HTML like counters or comment widgets. To force Markdown to interpret markup in <div>s, add a markdown="1" attribute to the div. (Note: this doesn't currently work in Text::Markdown (the module used by MojoMojo), but is being worked on).

Escaping characters

  • Textile: generally impossible, although particular characters can be escaped (HTML named entities), numeric entities cannot (&#x5f; will be rendered literally, not as an underscore)
  • Markdown: simply backslash-escape the character: \_internal_function_with_trailing_underscore_

Integration with HTML

  • Textile: TODO
  • Markdown: all HTML tags are interpreted as HTML. Markdown is interpreted in inline tags (e.g. <span>, <cite> or <ins>/<del>). Markdown is not processed within block-level HTML tags (<table>, <div>, ` etc.). While you can't use a Markdown-stylelink` inside an HTML table, for example, this is flagged as a feature request for Text::Markdown.

Definition Lists

  • Both Textile and MultiMarkdown have a syntax for definition lists but MojoMojo currently doesn't support the MultiMarkdown syntax.

Footnotes

  • Textile's footnoting is simpler: [1] as the footnote anchor and fn1. My foonote where the footnote text should appear. On the other hand, it is impossible to define named footnotes, which are extensively used on Wikipedia in large documents, or when one reference substantiates multiple facts.
  • Markdown's is more semantic and adds a link back [^my_footnote] ... [^my_footnote]: A note about my foot. A [multiple references to the same footnote bug] http://www.contentrules.com/ tech comm (http://groups.google.com/group/multimarkdown/browse_thread/thread/e714c49b5b6ab661) in MultiMarkdown causes the footnote to be repeated for each reference, and the anchor counter to increase.

Tables

  • Textile: tables with headings, table/row/column style attributes, vertical alignment and row/column span. No linebreaks between rows and no horizontal alignment.
  • Markdown: tables with captions, headings, horizontal alignment, horizontal column spanning, and line breaks allowed between rows for improved readability (interpreted as <tbody> sections). No vertical alignment or row spanning. Pipe characters in text within table cells must be escaped as &#124; (backslash-escaping doesn't work in this case with MultiMarkdown).

Demo: captions, table headers, cell alignment and column spans

Example copied from the MultiMarkdown syntax guide:

Prototype table
Grouping
First Header Second Header Third Header
Content Long Cell
Content Cell Cell
New section More Data
And more And more

Images

TODO

Limitations

Newlines in lists

  • Textile2: newlines break lists. It thus becomes impossible to render blockquotes or blocks of code in lists because the "bq." or "bc." block signature requires being surrounded by blank lines, and blank lines break lists:

    # First,
    
    
    bq. Avoid problems, and you'll never be the one who overcame them.
    -- Richard Bach
    
    
    # Second item, but will be numbered "1"
    
    
    bq. There is no elevator to success. You have to take the stairs.
    

    To achieve this, one must fall back to HTML.

  • Markdown's documentation explicitly tells how to "put a blockquote within a list item" (or a code section). This very list including the code section above short term loans that has been written using Markdown.

Which one do you prefer?

You can submit your preference for Markdown vs. Textile at the Mark-it-up survey.

Credits

Author: Dan Dascalescu

Thanks to Mateu X. Hunter for the initial draft.

My tags:
 
Popular tags:
 
Powered by Catalyst