Building a web page in markdown
rentry.co
It can seem a little like going backwards if you're used to HTML and PHP, but markdown does provide some advantages for building websites. In particular, if you want user input to be formatted nicely - without giving users complete access to run code on your server. Markdown can also be a quick and efficient alternative to cumbersome HTML seen in components like ordered and unordered lists. The following is accomplished with 4 dashes and 2 tabs:
- dash1
- dash2
- tabdash1
- tabdash2
index
You can even quickly build a dynamic table of contents with a simple code like [TOC]. As new headers are added to the page, they're also added to the following index:
It even automatically tags locations on the page and inserts links to the heading in the table of contents!
easy tables
Even tables can be simplified. While they're a great way to organize information, HTML has made producing them tedious - to say the least. Markdown can enable simple tables in the following format:
When input without the code blocks, it looks like this:
| Pros | Cons |
|---|---|
| Good thing | Bad thing |
| Good thing | Bad thing |
The HTML for that table would be... well, it would be a lot more than I want to type out. And I don't have to, because markdown makes it easy. Just for the sake of argument, though, let's look at that table in HTML:
maybe html is backwards
After spending just a few minutes with the markdown reference I'm already feeling pretty confident with images, links, tables, and code blocks. We even got a free table of contents that has updated three times since I added it!
While a lot of content management systems try to incorporate the ease of use that markdown has mastered, it's never quite the same.
