Markdown
Markdown
of Contents
Introduction 1.1
About Markdown 1.2
Titles 1.3
Links 1.4
Images 1.5
Code Blocks 1.6
Tables 1.7
2
Introduction
Learn Markdown
You may have heard about Markdown, if you have it's a good thing.
Markdown is a plain text formatting syntax designed so that it can optionally be converted to
HTML.
In this book, you'll learn how to write document using the markdown syntax.
3
About Markdown
Taking cues from existing conventions for marking up plain text in email such as setext, the
language was designed to be readable as-is, without looking like it's been marked up with
tags or formatting instructions, unlike text which has been formatted with a Markup
language, such as HTML, which has obvious tags and formatting instructions. Markdown is
a formatting syntax for text that can be read by humans and can be easily converted to
HTML.
Gruber wrote a Perl script, Markdown.pl, which converts marked-up text input to valid, well-
formed XHTML or HTML and replaces left-pointing angle brackets ('<') and ampersands with
their corresponding character entity references. It can be used as a standalone script, as a
plugin for Blosxom or Movable Type, or as a text filter for BBEdit.
Markdown has since been re-implemented by others as a Perl module available on CPAN
(Text::Markdown), and in a variety of other programming languages. It is distributed under a
BSD-style license and is included with, or available as a plugin for, several content-
management systems.
Use Cases
Markdown is used in GitHub, GitBook, Reddit, Diaspora, Stack Overflow,
OpenStreetMap, and many others.
Even this book is written using Markdown: Raw content of this page.
Files
A markdown document is a text file with the .md extension. You can open a markdown file
using a simple text editor.
4
Titles
Titles
As we started writing a markdown document, we need to add a title and some sub-headers.
Setext-style headers are underlined using equal signs (for first-level headers) and dashes
(for second-level headers). For example:
This is an H1
=============
This is an H2
-------------
Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header
levels 1-6. For example:
# This is an H1
## This is an H2
###### This is an H6
Optionally, you may close atx-style headers. This is purely cosmetic you can use this if
you think it looks better. The closing hashes dont even need to match the number of hashes
used to open the header. (The number of opening hashes determines the header level.) :
# This is an H1 #
## This is an H2 ##
[x] # hello
[ ] #hello
5
Titles
Headers need space between the hash characters and the text.
[ ]
test
########
[x]
test
=======
6
Links
Links
Markdown supports two styles of links: inline and reference.
To create an inline link, use a set of regular parentheses immediately after the link texts
closing square bracket. Inside the parentheses, put the URL where you want the link to
point, along with an optional title for the link, surrounded in quotes. For example:
Reference-style links use a second set of square brackets, inside which you place a label of
your choosing to identify the link:
Then, anywhere in the document, you define your link label like this, on a line by itself:
GitHub and GitBook supports URL autolinking. They will autolink standard URLs, so if you
want to link to a URL (instead of setting link text), you can simply enter the URL and it will be
turned into a link to that URL.
[x] [a link](http://google.fr)
7
Links
[ ] (a link)[http://google.fr]
What are the correct informations from this link: [a link](http://google.fr "google")
Links can have 3 parts: the text, the url and a title.
8
Images
Images
# Inline

# Reference
![Alternative text][id]
[id]: url/to/image "Optional title"
As you may have noticed, images in Markdown are very similar to links. The difference is
that:
[ ] [Google logo](https://www.google.ru/logo.png)
[x] 
Images must be prefixed with an exclamation mark. The alternative text and a title are
optional.
What is true about the following line: 
Similarly to links, images can have 3 parts: the alternative text, the url and a title. An
exclamation mark is nesessary.
9
Code Blocks
Code Blocks
Pre-formatted code blocks are used for writing about programming or markup source code.
Rather than forming normal paragraphs, the lines of a code block are interpreted literally.
Here is an example:
To produce a code block in Markdown, simply indent every line of the block by at least 4
spaces or 1 tab.
For example:
```
For example:
Syntax highlighting
You can define the language to be used for syntax highlighting by adding the name on the
opening tag. Example:
```js
var a = {};
```
10
Code Blocks
11
Tables
Tables
Tables aren't part of the core Markdown spec, but they are part of GFM (GitHub Markdown)
and Markdown Here supports them.
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up
prettily. You can also use inline Markdown.
Example:
12