Markdown for markup

Opinion
Jul 5, 20063 mins

* Markdown to HTML

I rather doubt that there’s anyone reading this newsletter who hasn’t heard of markup languages. But how many of you have heard of “markdown”?

And, no, before you say anything, a markdown language is not a mechanism for labeling discounts. A markdown language is a system for creating markup but in a simplified text form (called markdown) that is then translated to markup.

“Markdown is intended to be as easy-to-read and easy-to-write as is feasible. Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions.” That quote comes from a site that offers a translator for converting from a markdown language called Markdown to HTML.

The site continues: “Markdown’s syntax is intended for one purpose: to be used as a format for writing for the Web. Markdown is not a replacement for HTML, or even close to it.”

The syntax of Markdown is small and simple covering a very small subset of HTML tags to make it easy to read, write, and edit prose. As Markdown’s creator, John Gruber, points out: “HTML is a publishing format; Markdown is a writing format.”

The translation of Markdown is handled by a Perl program that works with a number of blogging systems (Movable Type, Blosxom, and BBEdit) or as a standalone command line application.

I won’t try to explain all of the aspects of Markdown but rather give you a brief taste:

1. You can indicate heading levels in two ways – either by underlining text with double dashes which translates to

or single dashes indicating an

or by prefacing the text with one or more # signs indicating the heading level (thus, “#”is

, “##” is

, and so on).

2. Blockquotes are indicated by “> ” at the start of each line.

Here’s an example of Markdown text:

A First Level Header

====================

A Second Level Header

———————

Now is the time for all good men to come to

the aid of their country. This is just a

regular paragraph.

The quick brown fox jumped over the lazy

dog’s back.

### Header 3

> This is a blockquote.

>

> This is the second paragraph in the blockquote.

>

> ## This is an H2 in a blockquote

And here’s the output:

A First Level Header

A Second Level Header

Now is the time for all good men to come to

the aid of their country. This is just a

regular paragraph.

The quick brown fox jumped over the lazy

dog’s back.

Header 3

This is a blockquote.

This is the second paragraph in the blockquote.

This is an H2 in a blockquote

 

You can find out all about the Markdown syntax on the Basics page and the Syntax page.

Because of its simplicity, there will occasions where you will need HTML for markup that isn’t covered by Markdown’s syntax. In those cases, you use HTML without any prefacing or delimiting – Markdown knows the difference.

This is an interesting idea that could be incorporated into many content creation and management tools and provide a big productivity payback.