If you are a coder, you already know what HTML is - HyperText Markup Language. It is mainly used to format the text for the web, although HTML is not limited to that.
XML - Extensible Markup Language - is another markup language. Both uses tags to format the text.
In this post, we are going to discuss something different, which is Markdown. I hope this quick post will help you to grasp the basics of Markdown.
Table Of Contents
What is Markdown
Simply put, Markdown is a way to format text, without using complex tags.
It not only includes the syntax, but also includes the converter, which converts a Markdown syntax to corresponding HTML tags, so that it can be displayed on the web.
Why use Markdown? The Advantages
Let me give a context before getting into the advantages of Markdown.
We all know how to write simple texts using a software like Notepad (in Windows). It allows creating simple text documents, but doesn’t allow much formatting.
The disadvantage? Although basic programs like Notepad are easy to use, it is not at all useable when you want to create or read complex text documents.
There comes WYSIWYG editors. Microsoft Word, Google Docs, etc are examples. They allow you to use different styles of texts - paragraphs, headings, lists, tables, etc. Most content management systems like WordPress also support some form of WYSIWYG editor.
You can even embed images, tables, etc, using these sophisticated editors. But again, it has certain disadvantages.
The main one is that you have to frequently use your mouse to make the formatting.
For example, if you want to bold a part of the text, first you have to type it, then use the mouse or trackpad to select the text, then click on the appropriate button to make it bold.
From an author’s point of view, it is still an inconvenience, although better than a Notepad. The best way would be having a way to type and format texts without moving your fingers away from the keyboard.
That’s what Markdown offers. It gives a simple syntax to format the text while typing. For example, if you want to add a sub-heading (h2), just add two hash symbols in front of the text. No more selecting and clicking.
## Best Blogging Platforms - An Example Heading
Later the converter interprets all these notations and converts it into valid HTML. Not just HTML, free tools like Dillinger allows exporting Markdown texts to other formats like PDF too.
In short, Markdown gives the best of both worlds - WYSIWYG and HTML.
Also, you can use any text editor to write in Markdown, even Notepad, although it won’t do the conversion for you.
Disadvantages of Markdown
However, Markdown is not perfect either. The main disadvantage I found is:
- it doesn’t support all the tags that we usually use in a WYSIWYG editor.
For example, there is no direct way to add an image in a figure tag with caption. Some markdown supports plain
<img> tags, though.
Want to split your content into two rows?
No easy way other than using HTML code. Whereas in WordPress, you can insert a columns block, and set the number of columns, all using its graphical user interface.
In such cases, you feel the limitations of Markdown. Complex formatting are not possible, or requires more work.
Fortunately, Markdown supports raw HTML too, so if you want to create complex layouts, you can create them by entering HTML code in between Markdown.
But remember, the beauty of Markdown lies in its simplicity, which might be a justification for the lack of complex formatting tags.
Where to use Markdown
Here are some use cases where Markdown can be more convenient than a WYSIWYG editor:
- Writing blog posts (currently I am writing this blog post in VSCode)
- used in many static site generators like Hugo, Jekyll, etc.
- Taking notes (applications like Simplenote supports markdown)
- on Github (for creating software readme files)
- several other online platforms
So, you can use Markdown instead of Word or Docs, whenever writing is more important than the software features.
I first came across Markdown in Github. The Readme files you see on every Github repo is formatted using Markdown.
Likewise, there are several sites that support Markdown to format your texts.
The Ghost CMS is another example of a modern content management system that supports Markdown out of the box. Reddit is another example.
On such websites, you only need to enter your text in Markdown, and the sites take care of the rest, including conversion to HTML and displaying.
How to learn Markdown
Learning Markdown is much easier than learning HTML or XML. Getting the basic tags right should only take a couple of minutes.
There are several cheat sheets online. I have found the Markdown Guide website quite useful for learning the syntax.
The website also has a tools section where you can find several online and offline application for writing in Markdown.
Here are some of the tools that I have found useful:
Editors to Write Markdown
- MS VSCode: My go-to code editor, which also comes with syntax highlighting for markdown. There are also several plugins that allow previewing Markdown files inside VSCode. Auto-Open Markdown Preview is one of them. After installing the extension, use ctrl+K V to preview any markdown files.
- Simplenote: A note-taking app, which supports Markdown. As its name suggests, the application focuses on simplicity. And for that reason, it can be a good alternative to Evernote.
- Dillinger: An online markdown editor with live preview, and a nice user-interface. It also supports exporting markdown files to PDF, HTML, or Styled HTML files. Apart from that, you can also save your files to Github, Dropbox, Onedrive, Medium, or Google Drive.
- Markpad: A desktop application for creating markdown files.
Apart from these tools, several content management systems and site generators also support converting markdown files to web pages. Some of them are:
- Ghost CMS
- Hugo (this site is made using Hugo)
- Github pages
Different Markdown Variations
In the beginning, I had mentioned that the initial Markdown specification was created in 2004. There was also a converter along with it, which was written in Perl.
Overtime, several implementations came, which resulted in a lot of ambiguity.
Currently, there are several implementations that adhere to CommonMark. Some of them are:
You can also use these libraries if you want to integrate markdown conversion in your web projects.
So, I think Markdown is something you should use more often for writing texts and documents. Recently I noticed myself shifting more towards it from Google Docs and other apps.
It is quite easy to use that anyone can learn it, not just developers. Although it looks like a developer thing, you can use it without any coding experience with the help of a good text editor.