Learning Markdown

Markdown
Table of contents
Reading Time: 2 minutes

Markdown is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats using a tool by the same name. It is often used to format readme, for writing messages in online discussion forums, and to create rich text using a plain text editor.

So, here is a quick introduction to some of the elements of markdown.

  • Headers

Markdown provides 6 headers(H1-H6) similar to HTML.

To insert an H1 heading, you need to use a single #. For H2 use ## and so on till H6.

Eg: # This is a Header

  • Italics

If you want to write some content in italics, you can use * or _ (single hyphen).

Eg: This *word* is in italics or This _word _ is in italics.

  • Bold

To bold some content, you can use ** or __ (2 hyphens).

Eg: This **word** is in bold or This __word__ is in bold

  • Lists

To create an ordered list use two spaces and then the item number.

Eg: Here Spaces are determined using . (dot)

..1. Item1

..2. Item2 

To create an unordered list use two spaces and then *, – or +.

Eg: Here Spaces are determined using . (dot)

..* Item1

..* Item2

  • Links

To create a link, you can use the following syntax

1. [some text](link)

Eg:  [This is a link to google](https://www.google.com)

You can also provide title to a link.

Eg: [This is a link to google](http://www.google.com "Google")

2. You can also link to a header in the same file. Spaces in the heading are substituted by – (hyphen).

Eg: # Heading 1

To create a link to the above header :

[This is a link to Heading 1](#heading-1)

3. URLs in angular brackets acts as a link.

Eg:<http://www.google.com>

4. To create a reference style link:

[This is a link][reference]

[reference]: http://www.google.com

  • Images

Images can be used in two ways:

1. Inline style

![alt text](http://media02.hongkiat.com/ww-flower-wallpapers/roundflower.jpg "Image title")

2. Reference style

![alt text][img]

[img]: http://media02.hongkiat.com/ww-flower-wallpapers/roundflower.jpg "Image title"

  • Code Highlighting

For inline code-highlighting use ` (backtick).

Eg: This is `code`.

Block of code can be written using “` (three backticks) or indenting the code with four spaces.

Eg:

```
This is code
```
  • Tables

To create table in markdown, you can use | (pipes) and – (hyphens). Each column must be separated using — (3 hyphens)

Eg:

|Col 1|Col 2|
|—|—|
|data1|data2|

The outer pipes are optional.

  • Blockquotes

To add blockquotes, you can use >.

Eg: >This is a blockquote

  • Inline Html

You can also write raw Html in your markdown

Eg:

<dl><dt>Term</dt><dd>Description</dd></dl>

  •  Horizontal rule

You can use 3 or more * (astericks), – (hyphens) or _ (underscores ) to create an horizontal rule.

Eg: *** or ---

Here is the link for a sample markdown file:

Markdown File

IDE specifications:

You can use Intellij Idea to edit your md files. It provides the following plugins named:

Markdown Navigator and Markdown Support that helps to view styling of your md files.

Written by 

Geetika Gupta is a software consultant having more than 2.5 years of experience. She enjoys coding in languages such as C, C++, Java, Scala and also has a good knowledge of big data technologies like Spark, Hadoop, Hive and Presto and is currently working on Akka-HTTP and dynamoDB. Her hobbies include watching television, listening to music and travelling.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading