Mark up your next HTML project using Markdown

By June 11, 2013 February 27th, 2016 General

Writing HTML can be quite tedious due to the verbosity of the language’s syntax and in trying to remember all of those attributes and their values. If this sounds like your assessment of HTML, then we may have found a solution for you. Enter: Markdown. Markdown is a plain-text format language with easy-to-remember syntax, which is then converted into well-formed HTML using the Markdown translator.

Markdown was designed around the concept of using plain text to simply common HTML formatting tasks like setting heading styles, entering lists, etc. thus eliminating the need for matching pairs of opening and closing tags. Using this syntax makes it easy for anyone to generate well-formed HTML using any text editor, all without having to know HTML. Consider the following examples:

To create a heading in HTML you would typically use the h1 tag as in:
<h1>My Heading</h1>

The equivalent in Markdown would be:
# My Heading

The HTML for a number list would be:
<ul>
<li>First item</li>
<li>Second item</li>
</ul>

The equivalent in Markdown would be:
1. First item
2. Second item

Of course one of the first questions that comes up when seeing Markdown for the first time, is why would you use it when you can just write HTML directly.

Well to start with it’s easy. You could use it to allow a non techie to write the content for an HTML page without having to know HTML. So long as they are provided a cheat sheet for the syntax all should be well. Alternatively you could provide them an editor which translates WYSIWYG elements into markdown behind the scenes and then use the translator to output the Markdown to well-formed HTML.

Not only is Markdown easy but it’s also much faster than having to write HTML tags. This eliminates the need to worry about indentation and finding those matching closing tags which always seem to be hiding.

But probably the best reason is that it, namely the Markdown translator, produces very clean HTML code. You don’t have to worry about a jumbled mess of HTML tags like you do with other tools. You can be certain that the HTML output will be as simple as it can possibly be.

There are a number of tools for creating Markdown, some free, some not, but here are three that we came across that we found useful:

Dingus: Dingus is an online translator written by the creator of Markdown and is available from the official Markdown website. The translation code itself exists as a PERL script which is also available for download. For more see information see: http://daringfireball.net/projects/markdown/.

Markdown Pad: Markdown Pad is a downloadable application for Windows which translates Markdown to HTML in realtime as you type. We found this to be a great program as it tells you immediately if your syntax is correct. And while the paid version offers additional features, the free version works very well for most tasks. We did find the program to be a bit heavy weight though. It asked us to close Word and Excel during install, and also seems to be slow to load, but overall a worthwhile download. For more information see: http://markdownpad.com/.

Pandoc: Pandoc is an online translator which can translate between Markdown and HTML in either direction, as well as a number of other languages. This can be useful when you want to determine the equivalent Markdown syntax for existing Markdown. However, we found some of the Markdown syntax didn’t seem to match the Markdown specifications using this tool, but still seemed to work correctly, possibly indicating that Markdown my not be as well documented as it appears to be. For more information on Pandoc see: http://johnmacfarlane.net/pandoc/try/.

While we’ve found it fairly easy to work with Markdown it does have potential drawbacks. Critics have been quick to point out that while the syntax is easy to work with, it’s still yet another syntax that you have to remember, especially when first starting out. Others have also criticized the syntax itself claiming that it’s cryptic, limited in what it can accomplish, and actually very difficult to remember. Some have even gone so far as to suggest that it’s a completely useless tool that was created just for the sake of creating such a tool.

We agree with some of these points, but still think that it’s a worthwhile technology to have on hand so long as you have a good cheat sheet to call upon or a WYSIWYG editor that hides this behind the scenes.

In conclusion, if you need a way for non-HTML authors to create HTML, be sure to check out Markdown. For more information checkout:
http://daringfireball.net/projects/markdown/
http://en.wikipedia.org/wiki/Markdown

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.