Markdown

This is my first post using the WP-Markdown plugin.

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).”

I think the first time I’ve used Markdown was for GitHub Readme files. It feels very natural to structure text that way and it is very easy to add code snippets. GitHub also added a Markdown syntax cheat sheet. Just go to GitHub, press ‘m’ and you’ll see. For my recent code examples I’ve embedded GitHub gists but sometimes that’s just too much of an effort for small code snippets. If you have longer snippets which are also likely to be changed/versioned gists are the way to go.

As a desktop client I’ve used Mou which works great. Ideally I would like to see this kind of live preview in Sublime Text 2 to not have too many apps open. I guess there is no plugin for that yet, right?

This code here below comes after a newline and is indented by 4 spaces:

addEventListener 'click', (event) =>
  # fat arrow preserves the outer scope
  @foo = event.data

or a CoffeeScript class:

class Util

  @LOGS: ''

  @log: (msg) ->
    LOGS += "#{msg}\n"
    console?.log msg

window?.Util = Util
module?.exports = Util

Another area I started using Markdown is for inline comments in my CoffeeScript files. Docco is great for generating docs:

$ docco src/*.coffee
$ open docs/SomeClass.html

Example:

# ### Load user or list of users
# `id` Id of the user or null to get list
# `callback` Callback function `(err, data)`
getUser: (id, callback) ->
  $.get id, (event) ->
    if event.success
      callback null, event.result
    else
      callback event.error

Now that I am about to finish this post I can say that writing it using Markdown with the WordPress plugin works really great. Using a MySQL database to store Markdown feels kinda weird though but hey, Rome wasn’t build in one day neither.

Anywhere else Markdown is becoming popular or any other good tools?

Comments are closed.