Questions tagged [markdown]

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

Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz, allowing people “to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML language takes many cues from existing conventions for marking up plain text in email.

Markdown is also a Perl script written by Gruber, “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.

Stack Overflow uses Markdown.

This wiki entry was copied from Wikipedia.

Formatting using Markdown

Different Markdown dialects use slightly different formatting, but here are the general ideas:

You can use ** or __ to start and end bold text.

**Danger:** you need to prepare user inputs to avoid SQL injection.

You can use * or _ to start and end italic text.

_A Christmas Carol_ is a book written by Charles Dickens.

You can use backticks to format code text.

An `if` statement checks a condition, and runs code if it is true.

You can use ``` to format entire code blocks (like the one below)


Here is some code:

```
for (i = 0; i < 10; i++) {
    print "hi";
}
```

You can use > at the start of a line to insert a quote.

The specification says:
> You need to put x and y in brackets

Markdown dialects

A number of Markdown dialects are in widespread use, most of which add or enhance support for things like tables and links. Notable examples include

Babelmark may be used to compare the output generated by different implementations of Markdown.

Since 2014, you also have CommonMark, a strongly defined, highly compatible specification of Markdown (see "Standard Markdown is now Common Markdown").

8667 questions
684
votes
34 answers

View markdown files offline

Is there a way to display .md files offline so we know what it will look like once it's uploaded in Github? I'm referring to showing the README.md file as it would come out in Github, and not as for editing purposes. Needs to work on Mac and Windows…
enchance
  • 29,075
  • 35
  • 87
  • 127
673
votes
41 answers

Markdown to create pages and table of contents?

I started to use markdown to take notes. I use marked to view my markdown notes and its beautiful. But as my notes get longer I find it difficult to find what I want. I know markdown can create tables, but is it able to create table of contents,…
resting
  • 16,287
  • 16
  • 59
  • 90
615
votes
23 answers

How to indent a few lines in Markdown markup?

I want to write a few lines of text. They should be formatted normally except each line should start at the 6th column. I.e. I don't want the code block formatting rule to make this chunk of text look like code as I'll use other formatting like bold…
Meng Lu
  • 13,726
  • 12
  • 39
  • 47
582
votes
4 answers

Superscript in markdown (Github flavored)?

Following this lead, I tried this in a Github README.md:
seinecle
  • 10,118
  • 14
  • 61
  • 120
557
votes
18 answers

How do I center an image in the README.md file on GitHub?

I've been looking at the Markdown syntax used in GitHub for a while, but except resizing an image to the width of the README.md page, I can't figure out how to center an image in it. Is this possible? If so, how can I do it?
Johnny Pauling
  • 12,701
  • 18
  • 65
  • 108
545
votes
8 answers

How to highlight bash/shell commands in markdown?

How can I highlight the Bash/shell commands in Markdown files? For example, to highlight js, I write: ```js function () { return "This code is highlighted as Javascript!"} ``` To highlight HTML code I use ```html. How can we highlight Bash/shell…
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
509
votes
23 answers

How to add color to GitHub's README.md file

I have a README.md file for my project underscore-cli, and I want to document the --color flag. Currently, the only way to do this is with a screenshot (which can be stored in the project repository): But screenshots aren't text, preventing readers…
Dave Dopson
  • 41,600
  • 19
  • 95
  • 85
502
votes
14 answers

How to add new line in Markdown presentation?

How to add new line in Markdown presentation? I mean, something like \newline in TeX.
max04
  • 5,315
  • 3
  • 13
  • 21
462
votes
5 answers

How do I add a newline in a markdown table?

I have the following cells in a markdown table: something something that's rather long and goes on for a very long time something else I'd like to be able to insert a break in the middle line, so the middle column isn't so wide. How can I do…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
460
votes
12 answers

How can I embed a YouTube video on GitHub wiki pages?

I am fairly new to markup (though it's extremely easy to pickup). I am working on a package and am trying to get the wiki pages looking nice as a help manual. I can insert a YouTube video link into the wiki page pretty easily but how do I embed a…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
456
votes
26 answers

Is there a command line utility for rendering GitHub flavored Markdown?

I'm wondering if there is a command line utility for taking a GitHub flavored Markdown file and rendering it to HTML. I'm using a GitHub wiki to create website content. I've cloned the repository on my server and would then like to process it into…
McLeopold
  • 5,967
  • 5
  • 21
  • 14
446
votes
13 answers

Is there a way to add an animated GIF to a Markdown file?

I want to add this animated GIF to a GitHub flavored markdown file. If it can't be done in GitHub, is it possible to do it in another version of Markdown?
Zaynaib Giwa
  • 5,366
  • 7
  • 21
  • 26
425
votes
16 answers

How to embed a video into GitHub README.md?

Is it possible to embed a flash video into README.md on GitHub? It isn't showing up: https://github.com/mattdipasquale/PicSciP
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
425
votes
6 answers

New lines inside paragraph in README.md

When editing an issue and clicking Preview the following markdown source: a b c shows every letter on a new line. However, it seems to me that pushing similar markdown source structure in README.md joins all the letters on one line. I'd like the…
zoran119
  • 10,657
  • 12
  • 46
  • 88
408
votes
5 answers

How to markdown nested list items in Bitbucket?

I'm trying to see my markdown nested list items rendered with corresponding indentation when viewed in a browser live from the Bitbucket pages. But I can't figure out how it works even when using their examples (updated): * Item 1 * Item 2 * Item 3 …
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167