Talk to us today

Sri Lanka
  • 40/2/21, Chakkindarama Rd,
    Ratmalana,
    10390,
    Sri Lanka
Connect
Close

More of Markdown

More of Markdown

In the context of CMSs the editors have a special place. Each CMS keeps on top with the best content editors. SilverStripe CMS our preferred CMS ships with TinyMCE an advanced What You See Is What You Get (WYSIWYG) editor so as Wordpress, Craft CMS has a Redactor powered editor, and there are many more. It feels so great when you have a WYSIWYG editor in there, and when you get the advanced interface to editor content. However WYSIWYG does now always returns what you see. And this is why we promote What You Read Is What You Get (thats a term we built) editors. To give you with a few examples where WYSIWYG fails,

  • If you copy content from other sources like a word document, it copies over lots of meta data in there.
  • It can add unwanted HTML tags in the code
  • It also can remove certain HTML tags which you want to add in, like iframes, etc.
  • The HTML errors are not displayed on the editor itself, and you won't realise whether there is an issue until you publish your content.
  • You need to use HTML purify plugins to remove any additional codes, tags which you dont want to allow.
  • The content authors needs to follow certain guidelines which is a pain in most of the cases

Well we can list more, but lets talk more about Markdown, than talking bad about WYSIWYG.

 

What is Markdown

Markdown is a text-to-html conversion tool for web authors. It allows you to write easy to read, plain text which gets converted to semantic HTML. Unlike HTML with Markdown you don't need to write various tags to markup the contents. It serves two things mainly

  • Provides a plain text formatting syntax 
  • A software interface which convert the markdown documents to valid HTMLs 

Some history

Markdown was created by John Gruber (https://daringfireball.net/),  somewhere in 2004. Its goal is to provide an easy way of writing content, then gets converted to HTML. The original markdown project can be found here.

Why markdown?

I think I've given the answer above, its because it is an easy way to write content, and with markdown there are no hidden rigmaroles. What you are going to get is what you just typed in and read in there. You just type plain text and shouldn't be worried about closing HTML tags or missing `<` or `>` characters. The best thing about it is debugging your content (huh! debug content). Well if there is any unexpected behaviour of the pages you post with a WYSIWYG editor you'd have to go through the HTML view and read through the code to find the issues. It may also require some technical knowledge but with Markdown its just in front of you in plain text, and fixing issues is an easy process. 

Read through this example which outputs a list. 

<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>

 

And in Markdown this is just a list of items where every item is prefixed with an asterisk (*)

* Item 1
* Item 2
* Item 3
* Item 4

 

Isn't that just easy to read, write and debug ?

A bit of a cheat sheet

Okay, here are some tips on how to use markdown, and the syntax. 

Headings

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

 

Ordered and Un-ordered lists

1. Ordered list item 1
2. Ordered list item 2
3. Ordered list item 3

* Unordered list item 1
* Unordered list item 2
* Unordered list item 3

 

Italics and bold

*This is some italics text*
** This is some bold text**

You might also be using it without knowing

Its actually true, there is a good chance you'd be using markdown without knowing. Its being adopted by a lot of websites and applications. Some of them are:

  1. Github - is a hosted source code management application
  2. Trello - a project management system
  3. Slack - an online chat application
  4. Markdown enabled Wordpress - a blogging / web content management platform
  5. Markdown enabled SilverStripe CMS

I believe that there are many more.

Sounds interesting ?

It does isn't it? We are in love with it. Its an easy thing to learn and you'd get a lot, here's the Github markdown guide for more. There are many more implementations which supports writing mathematical formulas, latex. With our SilverStripe module we can help adding it on to your CMS as well.