Introduction

Today I learned about a new method that can be used to format text. It is a method that allows you to do all your writing without leaving the keyboard. This method is known as markdown.

The beauty of markdown is that it can then be automatically changed to html for publishing on the web. I’m just learning about this new method of formatting text, so I can’t speak authoritatively about what it can be used for, but I’ll try to show you how to use it for writing a blog post — and yes, this post is written using markdown.

Basic syntax

There are a number of tags that you can use to write markdown. The basic tags allow you to create bold and italics text without leaving your keyboard. If you enclose a word in *s it become italicized, if you enclose it in **s it becomes bold.

So for example * hello * would cause the word hello to appear in italic — you have to remove the spaces between the * and the word for this to work. Here is an example hello. Likewise ** hello ** would cause the word to appear in bold, like this hello.

To create headers, you place a # in front of a title. All the headers in this post are written this way. For a second level header, you precede the title with ##, and so on. Links can be represented using , where the square brackets contain the text that will appear to the user and the normal brackets contain the link. For example, list of commands was created by writing “list of commands” in the square brackets and the link of the page linked to in the normal brackets.

Coding

You can also use markdown to write code on your blog. To me this is a very useful function since I sometimes like to post about programming and would like a way to easily include code so that my readers can follow me. To write code you enclose the code block in three consecutive ~s, you can optionally include the name of the programming language being used to provide syntax highlighting. For example, below is a very simple code snippet written using markdown.

<code>int main(){
printf(“hello world”);
}
</code>

If you indent to use markdown for code, do not open the post for editing in the visual editor on WordPress it damages the formatting. It damaged the formatting for the code example above. Check out this link for the correctly formatted output.

Conclusion

That’s it ladies and gents, using the simple rules of markdown, you can write well formatted text using any text editor. If your text editor supports markdown, it will automatically change the formatting to what you have specified. If it doesn’t, it will just be plain text and will only be converted to the formatted version when you copy it to an editor or system that supports markdown — like WordPress for example.

Hope this post gives you a good idea about the basic functionally of markdown, will try to post about more advanced features as I learn about them. Until my next post, bye for now.

Leave a Reply

Your email address will not be published. Required fields are marked *

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