Markdown List



See full list on docs.microsoft.com. Escaping the dot, like by writing 2., avoids that Markdown recognizes 2. As an item of a (new or existing) numbered list. Hence, writing 2. Cat would avoid the new list with 1. To nest one list within another, indent each item in the sublist by four spaces. You can also nest other elements like paragraphs, blockquotes or code blocks.

Markdown is a lightweight and easy-to-use syntax for styling all forms of writing on the GitHub platform.

Lists are a formatting nightmare in HTML, but Markdown lists are incredibly easy to manage. For a bullet list, just prefix each like with a. or -or + and they will be converted to dots. You can also create nested lists; just indent a line with 4 spaces and it will be nested under the line above. Milk; Bread; Wholegrain. This list starts at #3 2. However, this item is #4, despite being prefixed with `2.` This list starts at #3; However, this item is #4, despite being prefixed with 2. This can be used to resume a list after it's been interrupted by other text/an image/a table/etc. My very favorite colors are: 1.

What you will learn:

  • How the Markdown format makes styled collaborative editing easy
  • How Markdown differs from traditional formatting approaches
  • How to use Markdown to format text
  • How to leverage GitHub’s automatic Markdown rendering
  • How to apply GitHub’s unique Markdown extensions

What is Markdown?

Markdown is a way to style text on the web. You control the display of the document; formatting words as bold or italic, adding images, and creating lists are just a few of the things we can do with Markdown. Mostly, Markdown is just regular text with a few non-alphabetic characters thrown in, like # or *.

You can use Markdown most places around GitHub:

  • Comments in Issues and Pull Requests
  • Files with the .md or .markdown extension

For more information, see “Writing on GitHub” in the GitHub Help.

Examples

It's very easy to make some words bold and other words italic with Markdown. You can even link to Google!

Syntax guide

Here’s an overview of Markdown syntax that you can use anywhere on GitHub.com or in your own text files.

Headers

Emphasis

Lists

Unordered

Ordered

Markdown lists

Images

Links

Blockquotes

Inline code

GitHub Flavored Markdown

GitHub.com uses its own version of the Markdown syntax that provides an additional set of useful features, many of which make it easier to work with content on GitHub.com.

Note that some features of GitHub Flavored Markdown are only available in the descriptions and comments of Issues and Pull Requests. These include @mentions as well as references to SHA-1 hashes, Issues, and Pull Requests. Task Lists are also available in Gist comments and in Gist Markdown files.

Syntax highlighting

Here’s an example of how you can use syntax highlighting with GitHub Flavored Markdown:

You can also simply indent your code by four spaces:

Here’s an example of Python code without syntax highlighting:

Task Lists

If you include a task list in the first comment of an Issue, you will get a handy progress indicator in your issue list. It also works in Pull Requests!

Tables

You can create tables by assembling a list of words and dividing them with hyphens - (for the first row), and then separating each column with a pipe |:

List

Would become:

First HeaderSecond Header
Content from cell 1Content from cell 2
Content in the first columnContent in the second column

SHA references

Any reference to a commit’s SHA-1 hash will be automatically converted into a link to that commit on GitHub.

Issue references within a repository

Any number that refers to an Issue or Pull Request will be automatically converted into a link.

Username @mentions

Typing an @ symbol, followed by a username, will notify that person to come and view the comment. This is called an “@mention”, because you’re mentioning the individual. You can also @mention teams within an organization.

Automatic linking for URLs

Any URL (like http://www.github.com/) will be automatically converted into a clickable link.

Strikethrough

Any word wrapped with two tildes (like ~~this~~) will appear crossed out.

Emoji

GitHub supports emoji!

To see a list of every image we support, check out the Emoji Cheat Sheet.

Last updated Jan 15, 2014

Much of what makes Markdown great is the ability to write plain text, and getgreat formatted output as a result. To keep the slate clean for the next author,your Markdown should be simple and consistent with the whole corpus whereverpossible.

We seek to balance three goals:

  1. Source text is readable and portable.
  2. Markdown files are maintainable over time and across teams.
  3. The syntax is simple and easy to remember.

Contents:

  1. Headings
  2. Lists
  3. Code
  4. Links

Document layout

In general, most documents benefit from some variation of the following layout:

  1. # Document Title: The first heading should be a level one heading, andshould ideally be the same or nearly the same as the filename. The firstlevel one heading is used as the page <title>.

  2. author: Optional. If you’d like to claim ownership of the document orif you are very proud of it, add yourself under the title. However,revision history generally suffices.

  3. Short introduction. 1-3 sentences providing a high-level overview of thetopic. Imagine yourself as a complete newbie, who landed on your “ExtendingFoo” doc and needs to know the most basic assumptions you take for granted.“What is Foo? Why would I extend it?”

  4. [TOC]: if you use hosting that supports table of contents, such as Gitiles,put [TOC] after the short introduction. See[TOC] documentation.

  5. ## Topic: The rest of your headings should start from level 2.

  6. ## See also: Put miscellaneous links at the bottom for the user who wantsto know more or didn’t find what she needed.

Character line limit

Obey projects’ character line limit wherever possible. Long URLs and tables arethe usual suspects when breaking the rule. (Headings also can’t be wrapped, butwe encourage keeping them short). Otherwise, wrap your text:

Often, inserting a newline before a long link preserves readability whileminimizing the overflow:

Trailing whitespace

Don’t use trailing whitespace, use a trailing backslash.

The CommonMark spec decreesthat two spaces at the end of a line should insert a <br /> tag. However, manydirectories have a trailing whitespace presubmit check in place, and many IDEswill clean it up anyway.

Best practice is to avoid the need for a <br /> altogether. Markdown createsparagraph tags for you simply with newlines: get used to that.

Markdown list syntax

Headings

ATX-style headings

Headings with = or - underlines can be annoying to maintain and don’t fitwith the rest of the heading syntax. The user has to ask: Does --- mean H1 orH2?

Add spacing to headings

Prefer spacing after # and newlines before and after:

Lack of spacing makes it a little harder to read in source:

Lists

Use lazy numbering for long lists

Markdown is smart enough to let the resulting HTML render your numbered listscorrectly. For longer lists that may change, especially long nested lists, use“lazy” numbering:

However, if the list is small and you don’t anticipate changing it, prefer fullynumbered lists, because it’s nicer to read in source:

Nested list spacing

When nesting lists, use a 4 space indent for both numbered and bulleted lists:

The following works, but it’s very messy:

Even when there’s no nesting, using the 4 space indent makes layout consistentfor wrapped text:

However, when lists are small, not nested, and a single line, one space cansuffice for both kinds of lists:

Code

Inline

Markdown List Item

`Backticks` designate inline code, and will render all wrapped contentliterally. Use them for short code quotations and field names:

Use inline code when referring to file types in an abstract sense, rather than aspecific file:

Backticks are the most common approach for “escaping” Markdown metacharacters;in most situations where escaping would be needed, code font just makes senseanyway.

Codeblocks

For code quotations longer than a single line, use a codeblock:

Declare the language

It is best practice to explicitly declare the language, so that neither thesyntax highlighter nor the next editor must guess.

Indented codeblocks are sometimes cleaner

Four-space indenting is also interpreted as a codeblock. These can lookcleaner and be easier to read in source, but there is no way to specify thelanguage. We encourage their use when writing many short snippets:

Escape newlines

Because most commandline snippets are intended to be copied and pasted directlyinto a terminal, it’s best practice to escape any newlines. Use a singlebackslash at the end of the line:

Markdown List

Nest codeblocks within lists

If you need a codeblock within a list, make sure to indent it so as to not breakthe list:

You can also create a nested code block with 4 spaces. Simply indent 4additional spaces from the list indentation:

Links

Long links make source Markdown difficult to read and break the 80 characterwrapping. Wherever possible, shorten your links.

Use informative Markdown link titles

Markdown link syntax allows you to set a link title, just as HTML does. Use itwisely.

Titling your links as “link” or “here” tells the reader precisely nothing whenquickly scanning your doc and is a waste of space:

Instead, write the sentence naturally, then go back and wrap the mostappropriate phrase with the link:

Images

Use images sparingly, and prefer simple screenshots. This guide is designedaround the idea that plain text gets users down to the business of communicationfaster with less reader distraction and author procrastination. However, it’ssometimes very helpful to show what you mean.

See image syntax.

Markdown List

Prefer lists to tables

Any tables in your Markdown should be small. Complex, large tables are difficultto read in source and most importantly, a pain to modify later.

Markdown List In List

List

Lists and subheadings usually suffice to present the same informationin a slightly less compact, though much more edit-friendly way:

However, there are times when a small table is called for:

Strongly prefer Markdown to HTML

Please prefer standard Markdown syntax wherever possible and avoid HTML hacks.If you can’t seem to accomplish what you want, reconsider whether you reallyneed it. Except for big tables, Markdown meets almostall needs already.

Every bit of HTML or Javascript hacking reduces the readability and portability.This in turn limits the usefulness of integrations withother tools, which may either present the source as plain text or render it. SeePhilosophy.

Gitiles does not render HTML.

Markdown Bold

This site is open source. Improve this page.