Introduction To Markdown For Programmers
Once humans used to write on stones to keep written records. Ancient people learned to use feathers as pens, and after that there were reed pens. If we fast forward in history, we we’ll get to the typewriter. Today of course we don’t need to use any of these as we have computers and a wide assortment of digital devices.
From the beginning of the history of computers, people wanted to write and save data with the help of computers, which was once rather difficult. Only few people could do it. But technology advanced and we started to write in the way that we call plain text now. Different applications were developed for improving writing and reading text data. We were not only satisfied with text but we wanted more. Colors, different font faces, images, videos, animations, etc. started to be included on our list. But we’re not done yet and are still trying to add new things to our reading and writing experience. This process is never gonna stop. We the humans have insatiable taste for perfection.
HTML And The Next
In the beginning of the web we only had plain text on the web, though the technology was advanced enough then to show multimedia inside text. But we needed to use different proprietary software for that. But we needed something that is open in standard and can be used with different types devices. We wanted something cross platform. Hypertext Markup Language (HTML) was created to serve the purpose.
But there is a problem with HTML! It is very difficult to write HTML by hand. You need to write all those html, head, title, body, etc. tags even if you want to write just one character. Again you have write start tags and end tags for everything. Though HTML is a cross platform portable document format, but we need something more simple. To view the data written in HTML instead of source code, we need special software called web browser. We want the portability, the sweetness of a cross platform system, but still we want something simple.
To satisfy our insatiable desire for perfection with the goodness of simplicity a lot of systems were developed. But most of them did not get our attention. We are not just eager to blindly accept every system. We need more, but with perfection and simplicity. We need something that can provide us with all the goodness of HTML but in more simpler fashion.
Programmers' Way Of Writing
We the programmers are addicted to source code that it's output. So, when we want to write something we want to write in plain text as we do when writing code in different programming languages. But we are not willing to write in pure HTML as it get dirty really quick. We want something that can be transformed into HTML but that will look good in source form. To do this the most useful thing is Markdown. It is a file format that looks great in source format and can be transformed to HTML, PDF, DOC and many other formats very easily. The best thing about Markdown format is, you can write everything in pure plain text and you will have no difficulty in understanding with the naked eye; even a non technical guy will not have difficulty in reading it. And it can be transformed into a multimedia document with just few commands or few clicks of mouse. Markdown files usually have the extension of '.md'. It's an open format and well loved by a lot of people over the world.
If you are programmer and have never used it then this is a good time you start using it. As you are programmer, you should have used Github, Gitlab, Bitbucket, etc. version control service provider websites. In most of the repositories you should have seen a file called 'README.md' whose content is shown by default on the repository home page. That file is a markdown file. If you view the raw markdown file instead of the rendered one, you will see extra hashes '#', greater than symbol '>', backticks `, etc. And you will see that you are not facing any difficulty in reading the document. That's the sweetness of markdown.
Getting Started With Markdown
To write markdown, you need no specialized computer application. You can use any type plain text editor. But to view it in the desired rich format along with different colorful things and the multimedia you need to use some tools or software to transform them to HTML, PDF, DOC, etc.
Along with many command line tools you can use different open source, free or proprietary software with graphical user interface. Among them Atom, Texts, Typora, MacDown, and MarkdownPad are notable editors. At this moment I am using MarkdownPad 2. You are free to use whichever you like. Most of the editors come with live preview feature. To get the result of your writing, use live preview or export in your desired document and view in a different application.
To test our examples I am going to create a file named test.md and I am going to use MarkdownPad2 with live preview turned on.
Common Text Formatting
You can easily make texts italic or bold with just some extra characters. Let's say you want to make the word bold to be bold when it is transformed into another format. To do this just put two star character (**) at the start and at the end of it.
Hey, I am **bold**
The above text will look like:
Hey, I am bold
If you want to make something italic then just put one start * character at the end and at the text.
Hi, I am Mr. *Italic*
The above text will look like the following:
Hi, I am Mr. Italic
Headers
In HTML we are accustomed to writing H1, H2, H2, etc. header for giving header lines special weight and meaning. With markdown it is easier to do that. Put one hash character (#) to make the line of text header one, two characters for header two and so on.
# Header One
Some text
## Header Two
Some more text
Quotation
To represent quotation in your text you can use greater than symbol (>) at the beginning of every line of the quotation text you want to put inside your document.
> Democracy is of the people,
> By the people and
> For the people
Will look like the following:
Democracy is of the people,
By the people and
For the people
(the rendering may break when you see this, so it is advised that you see the preview with your application)
Links
Links are very important part our daily life. To link to some link with its title, you have to do it in the following fashion.
Hey, [click here](http://www.discoversdk.com) to go to discoversdk.com
Will output:
Hey, click here to go to discoversdk.com
So, the title of the link in square brackets and the link inside ().
Writing Code And Code Block
The life of a programmer is impossible without code. So, often we want to put code inside of our documents. To write a block of code start the block with three backticks (```) and end with three more. You can also specify the programming language name at the end of the first three backticks.
```python
print("Hello World! I am writing with Markdown")
```
Depending on your settings in your editor or whatever tool you are using, the code block will be highlighted. So, you are going to get syntax highlight for free!
If you want to put single line of code in your text then you can use a single backtick for them. For example: `this is inline code`.
HTML Inside Markdown
If you are not satisfied with markdown and want to bring some HTML inside markdown then you are not thinking incorrectly. You can write HTML code inside your markdown. Try it to see the output.
And more
There are a lot of other things that cannot be covered in a single article. So, I am going to save them for a future article in my series of Markdown For Programmers articles.
More Than One Way To Do Something
In markdown you will have more than one way to do something. So, do not get confused if you find a different way to do something than shown in this article.
Conclusion
Markdown is addictive so use it with caution. If you are a programmer and you start using it, after getting accustomed to it, you will not be able to leave it. You will try to use it everywhere you can. It's really fun to use markdown not only for programmers but also for any type of people who want simplicity of plain text and want to get output in better rich format. Check back for future articles on it but till then keep practicing markdown.
Need to brush up on your Python? Check out the top 8 places to learn Python online—from basics to advance.
And stop by the homepage to search and compare thousands of SDK, APIs, and other dev tools.
Recent Stories
Top DiscoverSDK Experts
Compare Products
Select up to three two products to compare by clicking on the compare icon () of each product.
{{compareToolModel.Error}}
{{CommentsModel.TotalCount}} Comments
Your Comment