Many of the articles you find online that speak about using Markdown are mostly explaining the “What” and the “How”. But what about the “Why”?
Answer: Tons of reasons. Let’s go over just a few!
Ubiquitous support
So yeah, weird to have the first point be “well, everyone is using it”. But it’s probably the most important point, considering common use-cases for Markdown as a markup language.
If you are a developer, you are likely familiar with repository hosting sites like Github, Bitbucket, Beanstalk and many others. Within these apps, you will normally have what’s called a README file. When you save this file, it saves in your project as a .md
file (markdown’s file type extension). README files are almost always created as .md
files. The benefit to doing this is in Markdown as opposed to just straight text is the styling provided when Markdown converts to HTML, making your content more readable and easier to follow. And if I am writing a solid project description in Markdown, I can be certain that if someone has a Markdown viewer (online or desktop native), they will be able to see my documentation in the way I have created it.
It’s also easier on the eyes when you’re creating that content. Example:
// HTML markup... <h2>Some title</h2> <p>Some content discussing something so you can read it as paragraph text.</p> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> // ...vs Markdown markup that compiles to the same thing. ## Some title Some content discussing something so you can read it as paragraph text. * Item 1 * Item 2 * Item 3
Markdown is much easier to read as you create. That’s why Markdown is the go-to choice for writing online documentation. It provides ease-of-use and the ability to create perfectly semantic portions of content.
Templating
* Some frameworks have gone all the way with using Markdown as their markup of choice. Jekyll – a static-site generator built in Ruby – uses Markdown files that are wrapped in layout files, and then compiled into normal HTML. Kramdown is the flavor of Markdown that comes default with Jekyll, it allows for mixing of both HTML and markdown syntax. This allows for nearly entire pages compiled by Jekyll to be written in mostly Markdown. An example of a section of content in a Jekyll .md
file might look like:
... ( <div class="content-section" markdown="1"> {:.section-heading} ### Bald Eagle The bald eagle (Haliaeetus leucocephalus, from Greek hali "sea", aiētos "eagle", leuco "white", cephalos "head") is a bird of prey... [Learn More](https://en.wikipedia.org/wiki/Bald_eagle) </div> ...
A few things going on here:
- Markdown is turned on just for this link (Kramdown only)
- added “section-heading” as a class to an H3 (Kramdown only)
- “Learn More” link
Not to be caught up too much in the “What” again, but this is to show that you can end up writing most of an entire web page in Markdown, turning it off and on per section of content. This does add to the markup a bit more and may be somewhat hard to follow, which defeats one of the benefits of using Markdown in my opinion. But Kramdown is still something I enjoy using in small doses.
Kramdown is also just one of the many different flavors of Markdown. Since there can be differences in each of these different types of Markdown, many have tried to come together in bringing a consensus on the minimum requirements for a Markdown version. More on the current status of this – referred to as CommonMark – can be found here.
Easy to implement into your project
Getting markdown parsed for your project can also go pretty smoothly. There are a number of programming languages and frameworks, popular or otherwise, that can integrate Markdown into generating into HTML markup. Just to shine a light on a few:
- Python – Python-Markdown
- Ruby – Redcarpet
- PHP – Parsedown
- Javascript – Markdown.js
- React.JS – React Markdown
Markdown is a generally well-accepted markup language that provides ease-of-use and wide support, that will only grow as the development community pushes to specify what the many (probably too many) flavors of Markdown should adhere to. It has multiple use-cases, but the number one reason for me to use it as much as I do? It’s fun to write in!