Markdown code block

Markdown code block

Markdown Reference

Overview

Markdown is created by Daring Fireball; the original guideline is here. Its syntax, however, varies between different parsers or editors. Typora try to follow GitHub Flavored Markdown, but may still have small incompatibilities.

Table of Contents

Block Elements

Paragraph and line breaks

A paragraph is simply one or more consecutive lines of text. In markdown source code, paragraphs are separated by two or more blank lines. In Typora, you only need one blank line (press Return once) to create a new paragraph.

Press Shift + Return to create a single line break. Most other markdown parsers will ignore single line breaks, so in order to make other markdown parsers recognize your line break, you can leave two spaces at the end of the line, or insert
.

Headers

Headers use 1-6 hash ( # ) characters at the start of the line, corresponding to header levels 1-6. For example:

In Typora, input ‘#’s followed by title content, and press Return key will create a header. Or type ⌘1 to ⌘6 as a shortcut.

Blockquotes

Markdown uses email-style > characters for block quoting. They are presented as:

In Typora, typing ‘>’ followed by your quote contents will generate a quote block. Typora will insert a proper ‘>’ or line break for you. Nested block quotes (a block quote inside another block quote) by adding additional levels of ‘>’.

Lists

Typing 1. list item 1 will create an ordered list.

Task List

Task lists are lists with items marked as either [ ] or [x] (incomplete or complete). For example:

You can change the complete/incomplete state by clicking on the checkbox before the item.

(Fenced) Code Blocks

Typora only supports fences in GitHub Flavored Markdown, not the original code block style.

Math Blocks

You can render LaTeX mathematical expressions using MathJax.

In the markdown source file, the math block is a LaTeX expression wrapped by a pair of ‘$$’ marks:

You can find more details here.

Tables

Standard Markdown has been extended in several ways to add table support., including by GFM. Typora supports this with a graphical interface, or writing the source code directly.

Enter | First Header | Second Header | and press the return key. This will create a table with two columns.

After a table is created, placing the focus on that table will open up a toolbar for the table where you can resize, align, or delete the table. You can also use the context menu to copy and add/delete individual columns/rows.

The full syntax for tables is described below, but it is not necessary to know the full syntax in detail as the markdown source code for tables is generated automatically by Typora.

In markdown source code, they look like:

You can also include inline Markdown such as links, bold, italics, or strikethrough in the table.

By including colons ( : ) within the header row, you can set text in that column to be left-aligned, right-aligned, or center-aligned:

A colon on the left-most side indicates a left-aligned column; a colon on the right-most side indicates a right-aligned column; a colon on both sides indicates a center-aligned column.

Footnotes

MultiMarkdown extends standard Markdown to provide two ways to add footnotes.

Hover over the ‘fn1’ or ‘fn2’ superscript to see content of the footnote. You can use whatever unique identified you like as the footnote marker (e.g. “fn1”).

Hover over the footnote superscripts to see content of the footnote.

Horizontal Rules

YAML Front Matter

Table of Contents (TOC)

Enter [toc] and press the Return key to create a “Table of Contents” section. The TOC extracts all headers from the document, and its contents are updated automatically as you add to the document.

Span Elements

Span elements will be parsed and rendered right after typing. Moving the cursor in middle of those span elements will expand those elements into markdown source. Below is an explanation of the syntax for each span element.

Links

Markdown supports two styles of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

Inline Links

To create an inline link, use a set of regular parentheses immediately after the link text’s 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:

This is an example inline link. (

This link has no title attribute. (

Internal Links

To create an internal link that creates a ‘bookmark’ that allow you to jump to that section after clicking on it, use the name of the header element as the href. For example:

Reference Links

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

In Typora, they will be rendered like so:

This is an example reference-style link.

The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — for example, to link the word “Google” to the google.com web site, you could simply write:

In Typora, clicking the link will expand it for editing, and command+click will open the hyperlink in your web browser.

Typora will also automatically link standard URLs (for example: www.google.com) without these brackets.

Images

You are able to use drag and drop to insert an image from an image file or your web browser. You can modify the markdown source code by clicking on the image. A relative path will be used if the image that is added using drag and drop is in same directory or sub-directory as the document you’re currently editing.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Emphasis

Markdown treats asterisks ( * ) and underscores ( _ ) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag. For example:

GFM will ignore underscores in words, which is commonly used in code and names, like this:

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it with a backslash character:

Typora recommends using the * symbol.

Strong

A double * or _ will cause its enclosed contents to be wrapped with an HTML tag, e.g:

double asterisks

double underscores

Typora recommends using the ** symbol.

To indicate an inline span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

Use the printf() function.

Strikethrough

GFM adds syntax to create strikethrough text, which is missing from standard Markdown.

becomes Mistaken text.

Emoji :happy:

Inline Math

To trigger inline preview for inline math: input “$”, then press the ESC key, then input a TeX command.

You can find more details here.

Subscript

To use this feature, please enable it first in the Markdown tab of the preference panel. Then, use

to wrap subscript content. For example: H

Superscript

Highlight

You can use HTML to style content what pure Markdown does not support. For example, use this text is red to add text with red color.

Underlines

Underline isn’t specified in Markdown of GFM, but can be produced by using underline HTML tags:

Underline becomes Underline.

Embed Contents

Some websites provide iframe-based embed code which you can also paste into Typora. For example:

Video

You can use the HTML tag to embed videos. For example:

Other HTML Support

You can find more details here.

Here is the text of the first footnote. ↩

Here is the text of the second footnote. ↩

Creating and highlighting code blocks

In this article

Share samples of code with fenced code blocks and enabling syntax highlighting.

Fenced code blocks

You can create fenced code blocks by placing triple backticks «` before and after the code block. We recommend placing a blank line before and after code blocks to make the raw formatting easier to read.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Tip: To preserve your formatting within a list, make sure to indent non-fenced code blocks by eight spaces.

To display triple backticks in a fenced code block, wrap them inside quadruple backticks.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see «Enabling fixed-width fonts in the editor.»

You can add an optional language identifier to enable syntax highlighting in your fenced code block.

For example, to syntax highlight Ruby code:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

We use Linguist to perform language detection and to select third-party grammars for syntax highlighting. You can find out which keywords are valid in the languages YAML file.

You can also use code blocks to create diagrams in Markdown. GitHub supports Mermaid, GeoJSON, TopoJSON, and ASCII STL syntax. For more information, see «Creating diagrams.»

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Markdown Syntax

In different locations around Hub, you have the ability to format blocks of text. This formatting is applied using the Markdown markup syntax. Markdown is supported for the following features in Hub:

These widgets use Markdown to format text. These widgets can be placed on dashboards and project overview pages.

The project description that is shown on a project overview page is formatted in Markdown.

The agreement text that is presented to users who are required to accept an information notice to access Hub is formatted in Markdown.

The Markdown implementation in YouTrack follows the CommonMark specification with extensions. These extensions support formatting options that are not included in the formal specification like strikethrough text, tables, and autolinks.

To see any of these formatting options in action, paste the sample block of code into an input field that accepts Markdown.

Character Formatting

You can format inline text with the following Markdown syntax.

Surround text with two asterisks ( ** ) or two underscore characters ( __ ).

Surround text with single asterisks ( * )or underscore characters ( _ ).

Surround text with two tildes (

Surround text with single backquotes ( ` ).

Surround text with single underscore characters or two tildes inside two asterisks. Surround text with three asterisks to apply strong emphasis.

— it wasn’t _that_ important. Let’s try a few `combinations`: **This text is strong,

this text is strong with strikethrough

, and _this text is formatted with strong emphasis_** ***This text is formatted with strong emphasis too.***

Headings

Hub also supports an alternative syntax for heading levels 1 and 2:

For heading level 1, enter one or more = characters on the following line.

Paragraphs and Line Breaks

Contiguous lines of text belong to the same paragraph. Use the following guidelines to structure your content into paragraphs and enter line breaks.

To start a new paragraph, leave a blank line between lines of text.

To start a new line inside a paragraph, enter two trailing spaces at the end of the line of text.

Thematic Breaks

Create sections in your content with horizontal lines. Use any of the following methods to add a horizontal line:

Three underscores ( ___ )

Block Quotes

Use block quotes to call special attention to a quote from another source. You can apply character formatting to inline text inside the quoted block.

To set text as a quote block, start the line with one or more > characters. Follow these characters with a space and enter the quoted text. The number of > signs determines the level of nesting inside the quote block.

If your quote spans multiple paragraphs, each blank line must start with the > character. This ensures that the entire quote block is grouped together.

Indented Code Blocks

You can format blocks of text in a monospaced font to make it easier to identify and read as code.

To format a code block in Markdown, indent every line of the block by at least four spaces. An indented code block cannot interrupt a paragraph, so you must insert at least one blank line between a paragraph the indented code block that follows. The input is processed is as follows:

One level of indentation (four spaces) is removed from each line of the code block.

The contents of the code block are literal text and are not parsed as Markdown.

Any non-blank line with fewer than four leading spaces ends the code block and starts a new paragraph.

Fenced Code Blocks

Unlike indented code blocks, fenced code blocks have an info string that lets you specify which language is used for syntax highlighting. Language-specific highlights make the code easier to read.

Syntax highlighting is supported for a range of languages. YouTrack detects and highlights code in C, C++, C#, Java, JavaScript, Perl, Python, Ruby, and SH automatically. To highlight code in other languages, set the language in the info string (the line with the opening code fence). The following languages are supported: apollo (AGC/AEA Assembly Language), basic, clj (Clojure) css, dart, erlang, hs (Haskell), kt (Kotlin), lisp, llvm, lua, matlab, ml, mumps, n (Nemerle), pascal, proto, scala, sql, tcl, tex, vb, vhdl, wiki, xq, and yaml.

To create a fenced code block that spans multiple lines of code, set the text inside three or more backquotes ( «` ) or tildes (

Open and close the block with the same character.

Use the same number of characters to open and close the code fence.

Lists

Use the following syntax to create lists:

To create an ordered list, start the line with a number and a period ( 1. ). Increment subsequent numbers to format each item in the ordered list.

To nest an unordered list inside an unordered or ordered list, indent the line with two spaces. Nesting ordered lists is not supported.

Tables

Tables are a great tool for adding structure to your content. Use the following syntax to create tables:

To create columns, use vertical bars ( | ). The outer bars are optional.

Note that the columns don’t have to line up perfectly in the raw Markdown. You can also add character formatting to text inside the table.

All of the cells are left-justified. The syntax that aligns text to the right or center is not supported.

Links

There are several ways to insert hyperlinks with Markdown.

Inline with tooltip

Use inline formatting and add the tooltip in quotation marks after the URL.

Hub has also extended the standard syntax to include autolinks.

URLs and URLs in angle brackets are automatically converted into hyperlinks. For example:

Autolinks

Autolinks are absolute URIs and email addresses that are set inside angle brackets ( ). They are parsed as links, with the URL or email address as the link label. Unlike links that let you specify link text and tooltips, this syntax simply converts the URL or email address into a clickable link.

Hub supports an extended syntax for URLs. Any string that is parsed as a URL is converted into a clickable link, even without the angle brackets. Email addresses that are not set inside angle brackets are displayed as text.

Images

The syntax for images is similar to the syntax for links. To insert an inline image:

Wrap the alt text with brackets ( [ ] ).

Set the image URL and tooltip in parentheses ( ( ) ).

You can also use the reference style for images. To insert an image reference:

Wrap the alt text with brackets ( [ ] ).

Set the image reference in brackets ( [ ] ).

Backslash Escapes

When you have characters that are parsed as Markdown that you want to show as written, you can escape the character with the backslash ( \ ).

Backslashes before non-markup characters are shown as backslash characters.

Escaped characters are treated as regular characters. Their usual meaning in Markdown syntax is ignored.

Backslash escapes do not work in fenced code blocks, inline code spans, or autolinks.

Markdown has support for code blocks. There are three ways to include A Markdown code block in your document:

In this article, I’ll demonstrate all three ways to include code in a Markdown document.

Markdown inline code block

For starters, Markdown allows you to include inline code in your document. Inline code is surrounded by backticks (`). For example:

Inline code is useful to mention a piece of code in a document. For example, you might want to mention the print function in a document like above. Most of the time, this code won’t be highlighted by the syntax highlighter, however.

Fenced code blocks

A fenced code block is a block of code that is surrounded by three backticks (“`) and an optional language specifier. In the most basic form, you can leave out the language specifier. For example:

Enable syntax highlighting

To enable syntax highlighting for your Markdown code block, you need to specify the language right after the first three backticks, like so:

Both examples above will be rendered as a code block in the document. If a language is specified like in the first example, the syntax highlighter will be enabled for the selected language.

For a list of commonly available languages, see to list at the bottom of this article.

Indented code blocks

If fenced code blocks are an option for your specific Markdown parser, I recommend using them because you can specify the language of the code block.

The most basic markdown syntax for indented code blocks is to start a line with four spaces. This will be rendered as a code block in the document and is supported by all Markdown parsers. For example:

The upside of this method is that it is supported by pretty much all Markdown parsers, as far as I know. However, there are some downsides to using indented code blocks as well:

If possible, I strongly suggest using fenced code blocks.

Markdown code block language list

Which languages are supported, heavily depends on the Markdown parser you’re using. What follows here, is a list of many common languages and formats that you can try. If your language isn’t in here, I suggest you simply try if it is supported. Alternatively, visit the documentation of your specific Markdown.

Here’s the list of commonly supported languages on sites like GitHub:

Learn more

Make sure to also check out my Markdown cheat sheet for a quick overview of what’s possible. You might also like to read more about including Markdown tables in your document, and my tricks to center stuff in Markdown.

Markdown Cheatsheet

Clone this wiki locally

This is intended as a quick reference and showcase. For more complete info, see John Gruber’s original spec and the Github-flavored Markdown info page.

Note that there is also a Cheatsheet specific to Markdown Here if that’s what you’re looking for. You can also check out more Markdown tools.

Table of Contents

Alternatively, for H1 and H2, an underline-ish style:

Emphasis, aka italics, with asterisks or underscores.

Strong emphasis, aka bold, with asterisks or underscores.

Combined emphasis with asterisks and underscores.

Strikethrough uses two tildes. Scratch this.

(In this example, leading and trailing spaces are shown with with dots: ⋅)

Actual numbers don’t matter, just that it’s a number

And another item.

You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we’ll use three here to also align the raw Markdown).

To have a line break without a paragraph, you will need to use two trailing spaces.
Note that this line is separate, but within the same paragraph.
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)

There are two ways to create links.

Or leave it empty and use the link text itself.

URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or http://www.example.com and sometimes example.com (but not on Github, for example).

Some text to show that the reference links can follow later.

Here’s our logo (hover to see the title text):

Code and Syntax Highlighting

Inline code has back-ticks around it.

Footnotes aren’t part of the core Markdown spec, but they supported by GFM.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Colons can be used to align columns.

TablesAreCool
col 3 isright-aligned$1600
col 2 iscentered$12
zebra stripesare neat$1

There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don’t need to make the raw Markdown line up prettily. You can also use inline Markdown.

MarkdownLessPretty
Stillrendersnicely
123

Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.

This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

You can also use raw HTML in your Markdown, and it’ll mostly work pretty well.

Extended Syntax

Advanced features that build on the basic Markdown syntax.

Overview

The basic syntax outlined in the original Markdown design document added many of the elements needed on a day-to-day basis, but it wasn’t enough for some people. That’s where extended syntax comes in.

Several individuals and organizations took it upon themselves to extend the basic syntax by adding additional elements like tables, code blocks, syntax highlighting, URL auto-linking, and footnotes. These elements can be enabled by using a lightweight markup language that builds upon the basic Markdown syntax, or by adding an extension to a compatible Markdown processor.

Availability

Not all Markdown applications support extended syntax elements. You’ll need to check whether or not the lightweight markup language your application is using supports the extended syntax elements you want to use. If it doesn’t, it may still be possible to enable extensions in your Markdown processor.

Lightweight Markup Languages

There are several lightweight markup languages that are supersets of Markdown. They include basic syntax and build upon it by adding additional elements like tables, code blocks, syntax highlighting, URL auto-linking, and footnotes. Many of the most popular Markdown applications use one of the following lightweight markup languages:

Markdown Processors

There are dozens of Markdown processors available. Many of them allow you to add extensions that enable extended syntax elements. Check your processor’s documentation for more information.

Tables

The rendered output looks like this:

SyntaxDescription
HeaderTitle
ParagraphText

Cell widths can vary, as shown below. The rendered output will look the same.

Alignment

You can align text in the columns to the left, right, or center by adding a colon ( : ) to the left, right, or on both side of the hyphens within the header row.

The rendered output looks like this:

SyntaxDescriptionTest Text
HeaderTitleHere’s this
ParagraphTextAnd more

Formatting Text in Tables

You can format the text within tables. For example, you can add links, code (words or phrases in backticks ( ` ) only, not code blocks), and emphasis.

You can’t use headings, blockquotes, lists, horizontal rules, images, or most HTML tags.

Escaping Pipe Characters in Tables

You can display a pipe ( | ) character in a table by using its HTML character code ( | ).

Fenced Code Blocks

The basic Markdown syntax allows you to create code blocks by indenting lines by four spaces or one tab. If you find that inconvenient, try using fenced code blocks. Depending on your Markdown processor or editor, you’ll use three backticks ( «` ) or three tildes (

) on the lines before and after the code block. The best part? You don’t have to indent any lines!

The rendered output looks like this:

Syntax Highlighting

Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code was written in. To add syntax highlighting, specify a language next to the backticks before the fenced code block.

The rendered output looks like this:

Footnotes

Footnotes allow you to add notes and references without cluttering the body of the document. When you create a footnote, a superscript number with a link appears where you added the footnote reference. Readers can click the link to jump to the content of the footnote at the bottom of the page.

To create a footnote reference, add a caret and an identifier inside brackets ( [^1] ). Identifiers can be numbers or words, but they can’t contain spaces or tabs. Identifiers only correlate the footnote reference with the footnote itself — in the output, footnotes are numbered sequentially.

Add the footnote using another caret and number inside brackets with a colon and text ( [^1]: My footnote. ). You don’t have to put footnotes at the end of the document. You can put them anywhere except inside other elements like lists, block quotes, and tables.

The rendered output looks like this:

Here’s a simple footnote, 1 and here’s a longer one. 2

This is the first footnote. ↩

Here’s one with multiple paragraphs and code.

Indent paragraphs to include them in the footnote.

Add as many paragraphs as you like. ↩

Heading IDs

Many Markdown processors support custom IDs for headings — some Markdown processors automatically add them. Adding custom IDs allows you to link directly to headings and modify them with CSS. To add a custom heading ID, enclose the custom ID in curly braces on the same line as the heading.

The HTML looks like this:

Linking to Heading IDs

You can link to headings with custom IDs in the file by creating a standard link with a number sign ( # ) followed by the custom heading ID. These are commonly referred to as anchor links.

MarkdownHTMLRendered Output
[Heading IDs](#heading-ids)Heading IDsHeading IDs

Other websites can link to the heading by adding the custom heading ID to the full URL of the webpage (e.g, [Heading IDs](https://www.markdownguide.org/extended-syntax#heading-ids) ).

Definition Lists

Some Markdown processors allow you to create definition lists of terms and their corresponding definitions. To create a definition list, type the term on the first line. On the next line, type a colon followed by a space and the definition.

The HTML looks like this:

The rendered output looks like this:

First Term This is the definition of the first term. Second Term This is one definition of the second term. This is another definition of the second term.

Strikethrough

) before and after the words.

The rendered output looks like this:

The world is flat. We now know that the world is round.

Task Lists

The rendered output looks like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Emoji

There are two ways to add emoji to Markdown files: copy and paste the emoji into your Markdown-formatted text, or type emoji shortcodes.

Copying and Pasting Emoji

In most cases, you can simply copy an emoji from a source like Emojipedia and paste it into your document. Many Markdown applications will automatically display the emoji in the Markdown-formatted text. The HTML and PDF files you export from your Markdown application should display the emoji.

Using Emoji Shortcodes

Some Markdown applications allow you to insert emoji by typing emoji shortcodes. These begin and end with a colon and include the name of an emoji.

The rendered output looks like this:

Gone camping! ⛺ Be back soon.

That is so funny! 😂

Highlight

The rendered output looks like this:

Alternatively, if your Markdown application supports HTML, you can use the mark HTML tag.

Subscript

This isn’t common, but some Markdown processors allow you to use subscript to position one or more characters slightly below the normal line of type. To create a subscript, use one tilde symbol (

) before and after the characters.

The rendered output looks like this:

Alternatively, if your Markdown application supports HTML, you can use the sub HTML tag.

Superscript

This isn’t common, but some Markdown processors allow you to use superscript to position one or more characters slightly above the normal line of type. To create a superscript, use one caret symbol ( ^ ) before and after the characters.

The rendered output looks like this:

Alternatively, if your Markdown application supports HTML, you can use the sup HTML tag.

Automatic URL Linking

Many Markdown processors automatically turn URLs into links. That means if you type http://www.example.com, your Markdown processor will automatically turn it into a link even though you haven’t used brackets.

The rendered output looks like this:

Disabling Automatic URL Linking

If you don’t want a URL to be automatically linked, you can remove the link by denoting the URL as code with backticks.

The rendered output looks like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Take your Markdown skills to the next level.

Learn Markdown in 60 pages. Designed for both novices and experts, The Markdown Guide book is a comprehensive reference that has everything you need to get started and master Markdown syntax.

Want to learn more Markdown?

Don’t stop now! 🚀 Star the GitHub repository and then enter your email address below to receive new Markdown tutorials via email. No spam!

Basic writing and formatting syntax

In this article

Create sophisticated formatting for your prose and code on GitHub with simple syntax.

To create a heading, add one to six # symbols before your heading text. The number of # you use will determine the size of the heading.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

When you use two or more headings, GitHub automatically generates a table of contents which you can access by clicking

within the file header. Each heading title is listed in the table of contents and you can click a title to navigate to the selected section.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

This was mistaken text

StyleSyntaxKeyboard shortcutExampleOutput
Bold** ** or __ __Command + B (Mac) or Ctrl + B (Windows/Linux)**This is bold text**This is bold text
Italic* * or _ _Command + I (Mac) or Ctrl + I (Windows/Linux)*This text is italicized*This text is italicized
StrikethroughThis was mistaken text
Bold and nested italic** ** and _ _**This text is _extremely_ important**This text is extremely important
All bold and italic*** ******All this text is important***All this text is important
SubscriptThis is a subscript textThis is a subscript text
SuperscriptThis is a superscript textThis is a superscript text

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

, then Quote reply. For more information about keyboard shortcuts, see «Keyboard shortcuts.»

You can call out code or a command within a sentence with single backticks. The text within the backticks will not be formatted. You can also press the Command + E (Mac) or Ctrl + E (Windows/Linux) keyboard shortcut to insert the backticks for a code block within a line of Markdown.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

To format code or text into its own distinct block, use triple backticks.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub. For more information, see «Enabling fixed-width fonts in the editor.»

Supported color models

In issues, pull requests, and discussions, you can call out colors within a sentence by using backticks. A supported color model within backticks will display a visualization of the color.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Here are the currently supported color models.

ColorSyntaxExampleOutput
HEX`#RRGGBB``#0969DA`Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block
RGB`rgb(R,G,B)``rgb(9, 105, 218)`Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block
HSL`hsl(H,S,L)``hsl(212, 92%, 45%)`Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Notes:

This site was built using [GitHub Pages](https://pages.github.com/).

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Tip: GitHub automatically creates links when valid URLs are written in a comment. For more information, see «Autolinked references and URLs.»

You can link directly to a section in a rendered file by hovering over the section heading to expose the link:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

You can define relative links and image paths in your rendered files to help readers navigate to other files in your repository.

A relative link is a link that is relative to the current file. For example, if you have a README file in root of your repository, and you have another file in docs/CONTRIBUTING.md, the relative link to CONTRIBUTING.md in your README might look like this:

![This is an image](https://myoctocat.com/assets/images/base-octocat.svg)

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Tip: When you want to display an image which is in your repository, you should use relative links instead of absolute links.

Here are some examples for using relative links to display an image.

Note: The last two relative links in the table above will work for images in a private repository only if the viewer has at least read access to the private repository which contains these images.

For more information, see «Relative Links.»

Specifying the theme an image is shown to

You can specify the theme an image is displayed for in Markdown by using the HTML

element in combination with the prefers-color-scheme media feature. We distinguish between light and dark color modes, so there are two options available. You can use these options to display images optimized for dark or light backgrounds. This is particularly helpful for transparent PNG images.

For example, the following code displays a sun image for light themes and a moon for dark themes:

The old method of specifying images based on the theme, by using a fragment appended to the URL ( #gh-dark-mode-only or #gh-light-mode-only ), is deprecated and will be removed in favor of the new method described above.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

To order your list, precede each line with a number.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

You can create a nested list by indenting one or more list items below another item.

Note: In the web-based editor, you can indent or dedent one or more lines of text by first highlighting the desired lines and then using Tab or Shift + Tab respectively.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

To create a nested list in the comment editor on GitHub, which doesn’t use a monospaced font, you can look at the list item immediately above the nested list and count the number of characters that appear before the content of the item. Then type that number of space characters in front of the nested list item.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

If a task list item description begins with a parenthesis, you’ll need to escape it with \ :

— [ ] \(Optional) Open a followup issue

For more information, see «About task lists.»

Mentioning people and teams

You can mention a person or team on GitHub by typing @ plus their username or team name. This will trigger a notification and bring their attention to the conversation. People will also receive a notification if you edit a comment to mention their username or team name. For more information about notifications, see «About notifications.»

Note: A person will only be notified about a mention if the person has read access to the repository and, if the repository is owned by an organization, the person is a member of the organization.

@github/support What do you think about these updates?

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

When you mention a parent team, members of its child teams also receive notifications, simplifying communication with multiple groups of people. For more information, see «About teams.»

Typing an @ symbol will bring up a list of people or teams on a project. The list filters as you type, so once you find the name of the person or team you are looking for, you can use the arrow keys to select it and press either tab or enter to complete the name. For teams, enter the @organization/team-name and all members of that team will get subscribed to the conversation.

The autocomplete results are restricted to repository collaborators and any other participants on the thread.

Referencing issues and pull requests

Referencing external resources

If custom autolink references are configured for a repository, then references to external resources, like a JIRA issue or Zendesk ticket, convert into shortened links. To know which autolinks are available in your repository, contact someone with admin permissions to the repository. For more information, see «Configuring autolinks to reference external resources.»

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Typing : will bring up a list of suggested emoji. The list will filter as you type, so once you find the emoji you’re looking for, press Tab or Enter to complete the highlighted result.

For a full list of available emoji and codes, check out the Emoji-Cheat-Sheet.

You can create a new paragraph by leaving a blank line between lines of text.

You can add footnotes to your content by using this bracket syntax:

The footnote will render like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Note: The position of a footnote in your Markdown does not influence where the footnote will be rendered. You can write a footnote right after your reference to the footnote, and the footnote will still render at the bottom of the Markdown.

Footnotes are not supported in wikis.

Hiding content with comments

You can tell GitHub to hide content from the rendered Markdown by placing the content in an HTML comment.

Ignoring Markdown formatting

You can tell GitHub to ignore (or escape) Markdown formatting by using \ before the Markdown character.

Let’s rename \*our-new-project\* to \*our-old-project\*.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

For more information, see Daring Fireball’s «Markdown Syntax.»

Disabling Markdown rendering

When viewing a Markdown file, you can click

at the top of the file to disable Markdown rendering and view the file’s source instead.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Disabling Markdown rendering enables you to use source view features, such as line linking, which is not possible when viewing rendered Markdown files.

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

gdenning / gist:1134759

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:

To put a blockquote within a list item, the blockquote’s > delimiters need to be indented:

It’s worth noting that it’s possible to trigger an ordered list by accident, by writing something like this:

In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:

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. Markdown wraps a code block in both

Markdown will generate:

A code block continues until it reaches a line that is not indented (or the end of the article).

Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it’s also easy to use Markdown to write about Markdown’s own syntax.

You can produce a horizontal rule tag ( ) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

Markdown supports two style of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text’s 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:

If you’re referring to a local resource on the same server, you can use relative paths:

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

You can optionally use a space to separate the sets of brackets:

Then, anywhere in the document, you define your link label like this, on a line by itself:

The following three link definitions are equivalent:

Note: There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.

The link URL may, optionally, be surrounded by angle brackets:

You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:

Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.

And then define the link:

Because link names may contain spaces, this shortcut even works for multiple words in the link text:

And then define the link:

Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they’re used, but if you want, you can put them all at the end of your document, sort of like footnotes.

Here’s an example of reference links in action:

Using the implicit link name shortcut, you could instead write:

Both of the above examples will produce the following HTML output:

For comparison, here is the same paragraph written using Markdown’s inline link style:

The point of reference-style links is not that they’re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it’s 176 characters; and as raw HTML, it’s 234 characters. In the raw HTML, there’s more markup than there is text.

With Markdown’s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Markdown treats asterisks ( * ) and underscores ( _ ) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag; double * ‘s or _ ‘s will be wrapped with an HTML tag. E.g., this input:

You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

Emphasis can be used in the middle of a word:

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

To indicate a span of code, wrap it with backtick quotes ( ` ). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

which will produce this:

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:

You can write this:

Admittedly, it’s fairly difficult to devise a «natural» syntax for placing images into a plain text document format.

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.

Inline image syntax looks like this:

Reference-style image syntax looks like this:

Where «id» is the name of a defined image reference. Image references are defined using syntax identical to link references:

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML tags.

Markdown supports a shortcut style for creating «automatic» links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

Markdown will turn this into:

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

into something like this:

which will render in a browser as a clickable link to «address@example.com».

(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won’t fool all of them. It’s better than nothing, but an address published in this way will probably eventually start receiving spam.)

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML tag), you can use backslashes before the asterisks, like this:

Markdown provides backslash escapes for the following characters:

Markdown: Syntax

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Overview

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters — including Setext, atx, Textile, reStructuredText, Grutatext, and EtText — the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Inline HTML

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

The only restrictions are that block-level HTML elements — e.g.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ’. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Block Elements

Paragraphs and Line Breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a
, but a simplistic “every line break is a
” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.

Headers

Markdown supports two styles of headers, Setext and atx.

Setext-style headers are “underlined” using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Optionally, you may “close” atx-style headers. This is purely cosmetic — you can use this if you think it looks better. The closing hashes don’t even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :

Blockquotes

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.

Unordered lists use asterisks, pluses, and hyphens — interchangably — as list markers:

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:

To put a blockquote within a list item, the blockquote’s > delimiters need to be indented:

To put a code block within a list item, the code block needs to be indented twice — 8 spaces or two tabs:

It’s worth noting that it’s possible to trigger an ordered list by accident, by writing something like this:

In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:

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. Markdown wraps a code block in both

Markdown will generate:

One level of indentation — 4 spaces or 1 tab — is removed from each line of the code block. For example, this:

A code block continues until it reaches a line that is not indented (or the end of the article).

Within a code block, ampersands ( & ) and angle brackets ( and > ) are automatically converted into HTML entities. This makes it very easy to include example HTML source code using Markdown — just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets. For example, this:

Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it’s also easy to use Markdown to write about Markdown’s own syntax.

Horizontal Rules

You can produce a horizontal rule tag ( ) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

Span Elements

Links

Markdown supports two style of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text’s 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:

If you’re referring to a local resource on the same server, you can use relative paths:

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

You can optionally use a space to separate the sets of brackets:

Then, anywhere in the document, you define your link label like this, on a line by itself:

The following three link definitions are equivalent:

Note: There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.

The link URL may, optionally, be surrounded by angle brackets:

You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:

Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.

Link definition names may consist of letters, numbers, spaces, and punctuation — but they are not case sensitive. E.g. these two links:

The implicit link name shortcut allows you to omit the name of the link, in which case the link text itself is used as the name. Just use an empty set of square brackets — e.g., to link the word “Google” to the google.com web site, you could simply write:

And then define the link:

Because link names may contain spaces, this shortcut even works for multiple words in the link text:

And then define the link:

Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they’re used, but if you want, you can put them all at the end of your document, sort of like footnotes.

Here’s an example of reference links in action:

Using the implicit link name shortcut, you could instead write:

Both of the above examples will produce the following HTML output:

For comparison, here is the same paragraph written using Markdown’s inline link style:

The point of reference-style links is not that they’re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it’s 176 characters; and as raw HTML, it’s 234 characters. In the raw HTML, there’s more markup than there is text.

With Markdown’s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Emphasis

Markdown treats asterisks ( * ) and underscores ( _ ) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag; double * ’s or _ ’s will be wrapped with an HTML tag. E.g., this input:

You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

Emphasis can be used in the middle of a word:

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

To indicate a span of code, wrap it with backtick quotes ( ` ). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

which will produce this:

The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:

You can write this:

Images

Admittedly, it’s fairly difficult to devise a “natural” syntax for placing images into a plain text document format.

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.

Inline image syntax looks like this:

Reference-style image syntax looks like this:

Where “id” is the name of a defined image reference. Image references are defined using syntax identical to link references:

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML tags.

Miscellaneous

Automatic Links

Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

Markdown will turn this into:

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

into something like this:

which will render in a browser as a clickable link to “[email protected]”.

(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won’t fool all of them. It’s better than nothing, but an address published in this way will probably eventually start receiving spam.)

Backslash Escapes

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML tag), you can use backslashes before the asterisks, like this:

Markdown provides backslash escapes for the following characters:

Copyright © 2002–2022 The Daring Fireball Company LLC.

Basic Syntax

The Markdown elements outlined in the original design document.

Overview

Nearly all Markdown applications support the basic syntax outlined in the original Markdown design document. There are minor variations and discrepancies between Markdown processors — those are noted inline wherever possible.

Headings

To create a heading, add number signs ( # ) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three (

), use three number signs (e.g., ### My Header ).

Heading level 1

Heading level 1

Heading level 2

Heading level 2

Heading level 3

Heading level 3

Heading level 4

Heading level 4

Heading level 5
Heading level 5
Heading level 6
Heading level 6

Alternate Syntax

MarkdownHTMLRendered Output
# Heading level 1

Heading level 1

Heading level 1

Heading level 2

Heading level 2

Heading Best Practices

Markdown applications don’t agree on how to handle a missing space between the number signs ( # ) and the heading name. For compatibility, always put a space between the number signs and the heading name.

MarkdownHTMLRendered Output
Heading level 1
===============
✅ Do this❌ Don’t do this
# Here’s a Heading

#Here’s a Heading

You should also put blank lines before and after a heading for compatibility.

✅ Do this❌ Don’t do this
Try to put a blank line before.

. and after a heading.

Without blank lines, this might not look right.
# Heading
Don’t do this!

Paragraphs

To create paragraphs, use a blank line to separate one or more lines of text.

I really like using Markdown.

I think I’ll use it to format all of my documents from now on.

I really like using Markdown.

I think I’ll use it to format all of my documents from now on.

Paragraph Best Practices

Unless the paragraph is in a list, don’t indent paragraphs with spaces or tabs.

MarkdownHTMLRendered Output
I really like using Markdown.

I think I’ll use it to format all of my documents from now on.

✅ Do this❌ Don’t do this
Don’t put tabs or spaces in front of your paragraphs.

Keep lines left-aligned like this.

This can result in unexpected formatting problems.

Don’t add tabs or spaces in front of paragraphs.

Line Breaks

To create a line break or new line (
), end a line with two or more spaces, and then type return.

This is the first line.

And this is the second line.

This is the first line.
And this is the second line.

Line Break Best Practices

You can use two or more spaces (commonly referred to as “trailing whitespace”) for line breaks in nearly every Markdown application, but it’s controversial. It’s hard to see trailing whitespace in an editor, and many people accidentally or intentionally put two spaces after every sentence. For this reason, you may want to use something other than trailing whitespace for line breaks. If your Markdown application supports HTML, you can use the
HTML tag.

For compatibility, use trailing white space or the
HTML tag at the end of the line.

There are two other options I don’t recommend using. CommonMark and a few other lightweight markup languages let you type a backslash ( \ ) at the end of the line, but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective. And at least a couple lightweight markup languages don’t require anything at the end of the line — just type return and they’ll create a line break.

MarkdownHTMLRendered Output
This is the first line.
And this is the second line.
✅ Do this❌ Don’t do this
First line with two spaces after.
And the next line.

First line with the HTML tag after.

And the next line.

First line with a backslash after.\
And the next line.

First line with nothing after.
And the next line.

Emphasis

You can add emphasis by making text bold or italic.

To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters.

MarkdownHTMLRendered Output
I just love **bold text**.I just love bold text.I just love bold text.
I just love __bold text__.I just love bold text.I just love bold text.
Love**is**boldLoveisboldLoveisbold

Bold Best Practices

Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold the middle of a word for emphasis.

✅ Do this❌ Don’t do this
Love**is**boldLove__is__bold

Italic

To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.

MarkdownHTMLRendered Output
Italicized text is the *cat’s meow*.Italicized text is the cat’s meow.Italicized text is the cat’s meow.
Italicized text is the _cat’s meow_.Italicized text is the cat’s meow.Italicized text is the cat’s meow.
A*cat*meowAcatmeowAcatmeow

Italic Best Practices

Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to italicize the middle of a word for emphasis.

✅ Do this❌ Don’t do this
A*cat*meowA_cat_meow

Bold and Italic

To emphasize text with bold and italics at the same time, add three asterisks or underscores before and after a word or phrase. To bold and italicize the middle of a word for emphasis, add three asterisks without spaces around the letters.

MarkdownHTMLRendered Output
This text is ***really important***.This text is really important.This text is really important.
This text is ___really important___.This text is really important.This text is really important.
This text is __*really important*__.This text is really important.This text is really important.
This text is **_really important_**.This text is really important.This text is really important.
This is really***very***important text.This is reallyveryimportant text.This is reallyveryimportant text.

Bold and Italic Best Practices

Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold and italicize the middle of a word for emphasis.

✅ Do this❌ Don’t do this
This is really***very***important text.This is really___very___important text.

Blockquotes

To create a blockquote, add a > in front of a paragraph.

The rendered output looks like this:

Dorothy followed her through many of the beautiful rooms in her castle.

Blockquotes with Multiple Paragraphs

Blockquotes can contain multiple paragraphs. Add a > on the blank lines between the paragraphs.

The rendered output looks like this:

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Nested Blockquotes

Blockquotes can be nested. Add a >> in front of the paragraph you want to nest.

The rendered output looks like this:

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Blockquotes with Other Elements

Blockquotes can contain other Markdown formatted elements. Not all elements can be used — you’ll need to experiment to see which ones work.

The rendered output looks like this:

The quarterly results look great!

Everything is going according to plan.

Blockquotes Best Practices

For compatibility, put blank lines before and after blockquotes.

✅ Do this❌ Don’t do this
Try to put a blank line before.

> This is a blockquote

. and after a blockquote.

Without blank lines, this might not look right.
> This is a blockquote
Don’t do this!

Lists

You can organize items into ordered and unordered lists.

Ordered Lists

To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.

Ordered List Best Practices

CommonMark and a few other lightweight markup languages let you use a parenthesis ( ) ) as a delimiter (e.g., 1) First item ), but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective. For compatibility, use periods only.

✅ Do this❌ Don’t do this
1. First item
2. Second item
1) First item
2) Second item

Unordered Lists

Starting Unordered List Items With Numbers

If you need to start an unordered list item with a number followed by a period, you can use a backslash ( \ ) to escape the period.

Unordered List Best Practices

Markdown applications don’t agree on how to handle different delimiters in the same list. For compatibility, don’t mix and match delimiters in the same list — pick one and stick with it.

✅ Do this❌ Don’t do this
— First item
— Second item
— Third item
— Fourth item
+ First item
* Second item
— Third item
+ Fourth item

Adding Elements in Lists

To add another element in a list while preserving the continuity of the list, indent the element four spaces or one tab, as shown in the following examples.

Paragraphs

The rendered output looks like this:

Here’s the second list item.

I need to add another paragraph below the second list item.

Blockquotes

The rendered output looks like this:

Here’s the second list item.

A blockquote would look great below the second list item.

Code Blocks

Code blocks are normally indented four spaces or one tab. When they’re in a list, indent them eight spaces or two tabs.

The rendered output looks like this:

Find the following code block on line 21:

Images

The rendered output looks like this:

Marvel at its beauty.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Lists

You can nest an unordered list in an ordered list, or vice versa.

The rendered output looks like this:

To denote a word or phrase as code, enclose it in backticks ( ` ).

Escaping Backticks

If the word or phrase you want to denote as code includes one or more backticks, you can escape it by enclosing the word or phrase in double backticks ( « ).

MarkdownHTMLRendered Output
«Use `code` in your Markdown file.«Use `code` in your Markdown file.Use `code` in your Markdown file.

Code Blocks

To create code blocks, indent every line of the block by at least four spaces or one tab.

The rendered output looks like this:

Horizontal Rules

The rendered output of all three looks identical:

Horizontal Rule Best Practices

For compatibility, put blank lines before and after horizontal rules.

✅ Do this❌ Don’t do this
Try to put a blank line before.

. and after a horizontal rule.

Without blank lines, this would be a heading.

Don’t do this!

Links

To create a link, enclose the link text in brackets (e.g., [Duck Duck Go] ) and then follow it immediately with the URL in parentheses (e.g., (https://duckduckgo.com) ).

The rendered output looks like this:

My favorite search engine is Duck Duck Go.

Adding Titles

You can optionally add a title for a link. This will appear as a tooltip when the user hovers over the link. To add a title, enclose it in quotation marks after the URL.

The rendered output looks like this:

My favorite search engine is Duck Duck Go.

URLs and Email Addresses

To quickly turn a URL or email address into a link, enclose it in angle brackets.

The rendered output looks like this:

Formatting Links

To emphasize links, add asterisks before and after the brackets and parentheses. To denote links as code, add backticks in the brackets.

The rendered output looks like this:

Reference-style Links

Reference-style links are a special kind of link that make URLs easier to display and read in Markdown. Reference-style links are constructed in two parts: the part you keep inline with your text and the part you store somewhere else in the file to keep the text easy to read.

Formatting the First Part of the Link

The first part of a reference-style link is formatted with two sets of brackets. The first set of brackets surrounds the text that should appear linked. The second set of brackets displays a label used to point to the link you’re storing elsewhere in your document.

Although not required, you can include a space between the first and second set of brackets. The label in the second set of brackets is not case sensitive and can include letters, numbers, spaces, or punctuation.

This means the following example formats are roughly equivalent for the first part of the link:

Formatting the Second Part of the Link

The second part of a reference-style link is formatted with the following attributes:

This means the following example formats are all roughly equivalent for the second part of the link:

You can place this second part of the link anywhere in your Markdown document. Some people place them immediately after the paragraph in which they appear while other people place them at the end of the document (like endnotes or footnotes).

An Example Putting the Parts Together

Say you add a URL as a standard URL link to a paragraph and it looks like this in Markdown:

Though it may point to interesting additional information, the URL as displayed really doesn’t add much to the existing raw text other than making it harder to read. To fix that, you could format the URL like this instead:

In both instances above, the rendered output would be identical:

In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a hobbit-hole, and that means comfort.

and the HTML for the link would be:

Link Best Practices

✅ Do this❌ Don’t do this
(https://www.example.com/my%20great%20page)

link

(https://www.example.com/my great page)

Images

The rendered output looks like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Linking Images

To add a link to an image, enclose the Markdown for the image in brackets, and then add the link in parentheses.

The rendered output looks like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Escaping Characters

To display a literal character that would otherwise be used to format text in a Markdown document, add a backslash ( \ ) in front of the character.

The rendered output looks like this:

* Without the backslash, this would be a bullet in an unordered list.

Characters You Can Escape

You can use a backslash to escape the following characters.

CharacterName
\backslash
`backtick (see also escaping backticks in code)
*asterisk
_underscore
curly braces
[ ]brackets
angle brackets
( )parentheses
#pound sign
+plus sign
minus sign (hyphen)
.dot
!exclamation mark
|pipe (see also escaping pipe in tables)

Many Markdown applications allow you to use HTML tags in Markdown-formatted text. This is helpful if you prefer certain HTML tags to Markdown syntax. For example, some people find it easier to use HTML tags for images. Using HTML is also helpful when you need to change the attributes of an element, like specifying the color of text or changing the width of an image.

To use HTML, place the tags in the text of your Markdown-formatted file.

The rendered output looks like this:

This word is bold. This word is italic.

HTML Best Practices

For security reasons, not all Markdown applications support HTML in Markdown documents. When in doubt, check your Markdown application’s documentation. Some applications support only a subset of HTML tags.

Use blank lines to separate block-level HTML elements like

from the surrounding content. Try not to indent the tags with tabs or spaces — that can interfere with the formatting.

You can’t use Markdown syntax inside block-level HTML tags. For example,

italic and **bold**

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Take your Markdown skills to the next level.

Learn Markdown in 60 pages. Designed for both novices and experts, The Markdown Guide book is a comprehensive reference that has everything you need to get started and master Markdown syntax.

Want to learn more Markdown?

Don’t stop now! 🚀 Star the GitHub repository and then enter your email address below to receive new Markdown tutorials via email. No spam!

Markdown code block

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.md’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

Markdown code block

Copy raw contents

Most of the examples from this documentation are in Markdown. Markdown is default parser for GitBook, but one can also opt for the AsciiDoc syntax.

Here’s an overview of Markdown syntax that you can use with GitBook (same as GitHub with some additions).

To create a heading, add one to six # symbols before your heading text. The number of # you use will determine the size of the heading.

GitBook supports a nice way for explicitly setting the header ID. If you follow the header text with an opening curly bracket (separated from the text with a least one space), a hash, the ID and a closing curly bracket, the ID is set on the header. If you use the trailing hash feature of atx style headers, the header ID has to go after the trailing hashes. For example:

Paragraphs and Line Breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line — a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

Unordered lists use asterisks, pluses, and hyphens — interchangably — as list markers:

Ordered lists use numbers followed by periods:

Markdown supports two style of links: inline and reference.

A simple link can be created by surrounding the text with square brackets and the link URL with parentheses:

Links can point to relative paths, anchors or absolute urls.

There is another way to create links which does not interrupt the text flow. The URL and title are defined using a reference name and this reference name is then used in square brackets instead of the link URL:

Then, anywhere in the document, you define your link label like this, on a line by itself:

Images can be created in a similar way than links: just use an exclamation mark before the square brackets. The link text will become the alternative text of the image and the link URL specifies the image source:

A blockquote is started using the > marker followed by an optional space; all following lines that are also started with the blockquote marker belong to the blockquote. You can use any block-level elements inside a blockquote:

The pipes on either end of the table are optional. Cells can vary in width and do not need to be perfectly aligned within columns. There must be at least three hyphens in each column of the header row.

Markdown supports two different code block styles. One uses lines indented with either four spaces or one tab whereas the other uses lines with tilde characters as delimiters – therefore the content does not need to be indented:

Fenced code blocks

You can create fenced code blocks by placing triple backticks «` before and after the code block. We recommend placing a blank line before and after code blocks to make the raw formatting easier to read.

You can add an optional language identifier to enable syntax highlighting in your fenced code block.

For example, to syntax highlight Ruby code:

Text phrases can be marked up as code by surrounding them with backticks:

GitBook supports a simple syntax for such footnotes. Footnotes are relative to each pages.

GitBook supports use of raw HTML in your text, Markdown syntax in HTML is not processed:

Horizontal Rules can be inserted using three or more asterisks, dashes or underscores, optionally separated by spaces or tabs, on an otherwise blank line:

Ignoring Markdown formatting

You can tell GitBook to ignore (or escape) Markdown formatting by using \ before the Markdown character.

VEnis / gist:7465176

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:

To put a blockquote within a list item, the blockquote’s > delimiters need to be indented:

It’s worth noting that it’s possible to trigger an ordered list by accident, by writing something like this:

In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:

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. Markdown wraps a code block in both

Markdown will generate:

A code block continues until it reaches a line that is not indented (or the end of the article).

Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it’s also easy to use Markdown to write about Markdown’s own syntax.

You can produce a horizontal rule tag ( ) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

Markdown supports two style of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text’s 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:

If you’re referring to a local resource on the same server, you can use relative paths:

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

You can optionally use a space to separate the sets of brackets:

Then, anywhere in the document, you define your link label like this, on a line by itself:

The following three link definitions are equivalent:

Note: There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.

The link URL may, optionally, be surrounded by angle brackets:

You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:

Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.

And then define the link:

Because link names may contain spaces, this shortcut even works for multiple words in the link text:

And then define the link:

Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they’re used, but if you want, you can put them all at the end of your document, sort of like footnotes.

Here’s an example of reference links in action:

Using the implicit link name shortcut, you could instead write:

Both of the above examples will produce the following HTML output:

For comparison, here is the same paragraph written using Markdown’s inline link style:

The point of reference-style links is not that they’re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it’s 176 characters; and as raw HTML, it’s 234 characters. In the raw HTML, there’s more markup than there is text.

With Markdown’s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Markdown treats asterisks ( * ) and underscores ( _ ) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag; double * ‘s or _ ‘s will be wrapped with an HTML tag. E.g., this input:

You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

Emphasis can be used in the middle of a word:

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

To indicate a span of code, wrap it with backtick quotes ( ` ). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

which will produce this:

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:

You can write this:

Admittedly, it’s fairly difficult to devise a «natural» syntax for placing images into a plain text document format.

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.

Inline image syntax looks like this:

Reference-style image syntax looks like this:

Where «id» is the name of a defined image reference. Image references are defined using syntax identical to link references:

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML tags.

Markdown supports a shortcut style for creating «automatic» links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

Markdown will turn this into:

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

into something like this:

which will render in a browser as a clickable link to «address@example.com».

(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won’t fool all of them. It’s better than nothing, but an address published in this way will probably eventually start receiving spam.)

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML tag), you can use backslashes before the asterisks, like this:

Markdown provides backslash escapes for the following characters:

Markdown code block

Copy raw contents

Markdown is a easy-to-use markup language for writing and this document contains all supported markdown features.

Table of contents

Headings from h1 through h6 are constructed with a # for each level:

Alternatively you can use underlines:

Just write normal text:

You can use multiple consecutive newline characters ( \n ) to create extra spacing between sections in a markdown document. However, if you need to ensure that extra newlines are not collapsed, you can use as many HTML
elements as you want.

Alternatively you can add two spaces spaces at the end of your paragraph to force a soft linebreak.

The HTML element is for creating a «thematic break» between paragraph-level elements. In markdown, you can use of the following for this purpose:

For emphasizing a snippet of text with a heavier font-weight.

The following snippet of text is rendered as bold text.

rendered as bold text

For emphasizing a snippet of text with italics.

The following snippet of text is rendered as italicized text.

rendered as italicized text

In GFM you can do strickthroughs by wrapping the text with double tildes.

Which renders to:

Strike through this text.

URIs or email addresses that are not wrapped in angle brackets are not recognized as valid autolinks by markdown parsers.

Renders to (hover over the link, there is no tooltip):

Renders to (hover over the link, there should be a tooltip):

Named anchors enable you to jump to the specified anchor point on the same page. For example, each of these chapters:

will jump to these sections:

Anchor placement

Note that placement of achors is arbitrary, you can put them anywhere you want, not just in headings. This makes adding cross-references easy when writing markdown.

Images have a similar syntax to links but include a preceding exclamation point.

Like links, Images also have a footnote style syntax

With a reference later in the document defining the URL location:

Used for defining a section of quoting text from another source, within your document.

To create a blockquote, use > before any text you want to quote.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

Blockquotes can also be nested:

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.

Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.

A list of items in which the order of the items does not explicitly matter.

You may use any of the following symbols to denote bullets for each list item:

A list of items in which the order of items does explicitly matter.

Sometimes lists change, and when they do it’s a pain to re-order all of the numbers. Markdown solves this problem by allowing you to simply use 1. before each item in the list.

Automatically re-numbers the items and renders to:

Links in todo lists

Tables are created by adding pipes as dividers between each cell, and by adding a line of dashes (also separated by bars) beneath the header (this line of dashes is required).

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Center text in a column

To center the text in a column, add a colon to the left and right of the dashes in the row beneath the header.

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Right-align the text in a column

To right-align the text in a column, add a colon to the right of the dashes in the row beneath the header.

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

For example, to show

«Fenced» code block

For example, this:

Appears like this when viewed in a browser:

You may also indent several lines of code by at least four spaces, but this is not recommended as it is harder to read, harder to maintain, and doesn’t support syntax highlighting.

Which renders to:

Github-Flavored Markdown (GFM) allows you to highlight keyboard keys.

For example, this:

Which renders to:

To copy, please press CmdOrCtrl + C

To paste, please press CmdOrCtrl + V

Github-Flavored Markdown (GFM) supports also Emojis. 😍 😄 😂

To add an emojis, just surround the emoji name with colons, like this:

Which renders to:

NOTE: MarkText provides an emoji picker with search functionality.

Front matter allows you to insert metadata to your markdown document. The front matter block must be written in the first line before everything else, like in the examples below.

TOML front matter blocks are identified by an opening and closing +++ line.

JSON front matter blocks are identified by an opening and closing ;;; line or < and >.

Inline Math Formulas

Block Math Formulas

For example, this:

MarkText support class, flow chart, gantt and sequence diagrams powered by flowchart.js, mermaid and Vega-Lite. Code blocks with special language identifiers are used for diagrams.

For example, this:

Please visit PlantUML website for more details.

Any text between and > that looks like an HTML tag will be parsed as a raw HTML tag and rendered to HTML without escaping.

Escaping with backslashes

Any ASCII punctuation character may be escaped using a single backslash.

*this is not italic*

This markdown cheatsheet was created by @jonschlinkert and modified. The source can be found here.

Footer

© 2022 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

safe1981 / gist:2019322

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:

It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:

To put a blockquote within a list item, the blockquote’s > delimiters need to be indented:

It’s worth noting that it’s possible to trigger an ordered list by accident, by writing something like this:

In other words, a number-period-space sequence at the beginning of a line. To avoid this, you can backslash-escape the period:

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. Markdown wraps a code block in both

Markdown will generate:

A code block continues until it reaches a line that is not indented (or the end of the article).

Regular Markdown syntax is not processed within code blocks. E.g., asterisks are just literal asterisks within a code block. This means it’s also easy to use Markdown to write about Markdown’s own syntax.

You can produce a horizontal rule tag ( ) by placing three or more hyphens, asterisks, or underscores on a line by themselves. If you wish, you may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

Markdown supports two style of links: inline and reference.

In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text’s 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:

If you’re referring to a local resource on the same server, you can use relative paths:

Reference-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:

You can optionally use a space to separate the sets of brackets:

Then, anywhere in the document, you define your link label like this, on a line by itself:

The following three link definitions are equivalent:

Note: There is a known bug in Markdown.pl 1.0.1 which prevents single quotes from being used to delimit link titles.

The link URL may, optionally, be surrounded by angle brackets:

You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:

Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output.

And then define the link:

Because link names may contain spaces, this shortcut even works for multiple words in the link text:

And then define the link:

Link definitions can be placed anywhere in your Markdown document. I tend to put them immediately after each paragraph in which they’re used, but if you want, you can put them all at the end of your document, sort of like footnotes.

Here’s an example of reference links in action:

Using the implicit link name shortcut, you could instead write:

Both of the above examples will produce the following HTML output:

For comparison, here is the same paragraph written using Markdown’s inline link style:

The point of reference-style links is not that they’re easier to write. The point is that with reference-style links, your document source is vastly more readable. Compare the above examples: using reference-style links, the paragraph itself is only 81 characters long; with inline-style links, it’s 176 characters; and as raw HTML, it’s 234 characters. In the raw HTML, there’s more markup than there is text.

With Markdown’s reference-style links, a source document much more closely resembles the final output, as rendered in a browser. By allowing you to move the markup-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose.

Markdown treats asterisks ( * ) and underscores ( _ ) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag; double * ‘s or _ ‘s will be wrapped with an HTML tag. E.g., this input:

You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span.

Emphasis can be used in the middle of a word:

But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

To indicate a span of code, wrap it with backtick quotes ( ` ). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:

which will produce this:

With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags. Markdown will turn this:

You can write this:

Admittedly, it’s fairly difficult to devise a «natural» syntax for placing images into a plain text document format.

Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.

Inline image syntax looks like this:

Reference-style image syntax looks like this:

Where «id» is the name of a defined image reference. Image references are defined using syntax identical to link references:

As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML tags.

Markdown supports a shortcut style for creating «automatic» links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

Markdown will turn this into:

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

into something like this:

which will render in a browser as a clickable link to «address@example.com».

(This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won’t fool all of them. It’s better than nothing, but an address published in this way will probably eventually start receiving spam.)

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. For example, if you wanted to surround a word with literal asterisks (instead of an HTML tag), you can use backslashes before the asterisks, like this:

Markdown provides backslash escapes for the following characters:

Markdown Extended Syntax

Advanced features based on the foundations of Markdown.

Introduction

The original Markdown syntax, published by John Gruber, added several essential elements for editing documents, but some users were not satisfied.

The extended syntax tries to resolve this dissatisfaction by adding new elements through new markups.

Tables, code blocks, automatic links generation and even footnotes are examples of extending the Markdown basic syntax.

These elements can be activated by installing a plugin for your Markdown processor or even using a small variation of the language.

NOTE: it is quite possible that your Markdown application already has support for the elements presented in this article, so it is worth testing each one of them while following the tutorial.

Flavors of Markdown

photo Markdown flavors

Markdown has a few different flavors, in other words, variations of the language basic syntax.

These variations, in addition to supporting basic syntax, add elements that enrich the document editing.

Applications compatible with Markdown will often use one of the languages presented below:

Creating tables in Markdown

A table in Markdown can be used to present data comparisons by the user.

photo Tables in Markdown

Below is an example table:

The vertical bars | used at the ends of the table are for purely cosmetic purposes, the table can be created without adding the side bars.

The output rendered in HTML:

TitleTitle
TextText
TextText

The width of the cells, within a Markdown table, can vary.

Generating tables in Markdown automatically

Markdown came to make document editing easier, and creating tables can become a bit more tedious.

The use of vertical bars and dashes may displease some users, so it is interesting that we can automate the process of formatting tables in Markdown.

photo Table structure in Markdown generated automatically.

Alignment

Markdown allows you to align the contents of a table column to the left, right or center.

FruitVegetablesVegetables
cashewCressCarrot
AppleBroccoliPea

NOTE: Using the colon to align the text to the left is optional, as the table contents are already aligned in that position by default.

FruitVegetablesVegetables
cashewCressCarrot
AppleBroccoliPea

To align the contents of the column to the center in a Markdown table, add a colon : before and after the dashes that separate the header line.

FruitVegetablesVegetables
cashewCressCarrot
AppleBroccoliPea

It is possible to merge the alignment formatting, since it only influences the content inside the column.

FruitVegetablesVegetables
cashewCressCarrot
AppleBroccoliPea
FruitVegetablesVegetables
cashewCressCarrot
AppleBroccoliPea

NOTE: The contents of the table header will also be aligned according to the position of the colon.

Formatting text in tables

You can insert some basic elements of Markdown inside a table.

Titles, code blocks, blockquotes, lists, horizontal rules, images and HTML tags do not work.

NOTE: You may find applications that accept the insertion of the elements mentioned above inside a table, but this will harm the portability of your document, since other programs do not support it.

Escaping vertical bars in tables

photo Escaping a vertical bar inside the table in Markdown

Fenced code block

A surrounded code block allows you to create code representations without having to indent the line in four spaces or a tab, in addition, it also allows you to define which programming language the block represents, with this, it is possible to apply the appropriate syntax highlighting.

To create a fenced code block in Markdown, place three backticks «` before the content and three backticks «` after the content.

The rendered output looks like this:

NOTE: Some Markdown processors allow you to use tildes

instead of backticks to form the fenced code block.

Syntax highlighting

Many JavaScript libraries are used to highlight code blocks, such as: Prism.js & highlight.js.

They take a specific HTML tag, usually the pre or code tag and apply highlighting based on the syntax of the code block’s programming language.

The language syntax is usually defined by the parameter class of tag, for example:

NOTE: The highlighting process can be done automatically, some tools have the ability to detect the programming languages ​​in an automated way, without the need to define the language in the class parameter.

As in the first line of the block, just after the three opening backticks, json was specified, the code will be highlighted accordingly:

NOTE: the code will only be highlighted if you use a JavaScript library that performs this type of task, HTML itself does not highlight the code.

Footnotes

A footnote in Markdown allows the user to create a reference to some concept mentioned in the document.

Typically, these footnotes are placed at the end of the document, but in Markdown you can define them anywhere in the text.

When creating a footnote a superscript number in the form of link will be inserted in the location that you created it, when the user clicks on that link it will be taken directly to the location that contains the reference of the note.

The syntax for creating the footnote is divided into two parts.

The identifier can contain numbers and letters, but does not accept spaces or tabs.

The rendering in golkie itc looks like this:

This is the first footnote. ↩

Here is one with several paragraphs and code.

Indent paragraphs to include them in the footnote.

Add as many paragraphs as you want. ↩

NOTE: The content of the footer can be placed anywhere in the document except inside other Markdown elements such as tables, lists and code blocks.

NOTE: Footnotes will always be numbered sequentially, regardless of the identifiers you created, a sequence of notes [^35], [^yyyy] and [^102_444], will be rendered as 1, 2 and 3.

Adding ID or Class to Markdown elements

With id we can get a specific reference for a particular element, normally the element’s id is unique within the HTML markup.

The parameter class is generic and can be assigned to several elements.

The function of id or class is to allow you to easily recognize these elements through JavaScript or CSS, using this id or this class we can handle properties such as color, size, placement, etc.

The HTML looks like this:

Links for ids in Markdown

MarkdownHTMLResultado
[Title IDs](#markdown-title-id)Title IDsTitle IDs

If the id is in another document, the formatting is similar, however, before identification, place the page URL.

Definition Lists

The HTML looks like this:

First term This is the definition of the first term. Second term This is a definition of the second term. This is another definition of the second term.

Strikethrough in Markdown

The strikethrough is used to correct an error comparatively, usually followed by correction on the same line.

The strikethrough is nothing more than a format that inserts a horizontal line in the middle of a piece of content.

To apply the strikethrough formatting to a content in Markdown use two tildes

before and after the text.

And the result is this:

Markdown is: difficult easy to learn.

Task lists in Markdown

The rendered output looks like this:

photo Task List in Markdown

Inserting Emojis in the Markdown document

Yes, you can insert the famous emoticons directly in the Markdown formatting of your document.

photo Emojis on Markdown

There are two most commonly used ways for the task, copying and pasting the emoji into the content or entering emoji codes.

We will understand better how the two procedures work, but first, click here to open our Markdown editor and test the emojis in real time.

Copying and pasting Emojis in Markdown

NOTE: You can explore Emojipedia to find your favorite emoji, the copy and paste procedure is the same for all of them.

If your Markdown application is compatible, you will see the representation of the emoticon directly in the text.

When converting the Markdown document to HTML or even PDF, the emojis are still represented correctly.

NOTE: If the HTML document is not rendering the emojis the way it should, encode the pages in UTF-8.

Using Emoji access codes

An emoji code is formed by identifying the emoticon surrounded by a colon.

To insert an emoji in Markdown using access code, place the emoticon code in between colons.

The rendered output looks like this:

I went camping! ⛺ I’ll be back soon.

This is so funny! 😂

Discovering the Emojis access code

If you don’t know the emoji access code, use our Markdown editor to find out.

In the left panel you can see the emoji code and in the right panel the rendering.

NOTE: The images of emoticons can vary greatly from application to application, in this list you find the emojis compatible with Markdown used by GitHub, you can test them in your application to find out if there are compatibility.

Automatic linking URLs in Markdown

Some Markdown processors turn URL into links when they find an address between the less than and greater than > signs.

On other occasions, embedding the address between <> is not necessary, just insert the URL in the document and the application will automatically convert it.

The rendered output looks like this:

Disabling automatic URL linking

The rendered output looks like this:

NOTE: It is worth remembering that the use of backticks to surround content transforms it into code.

Markdown code block

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Alternatively, a line ending with a backslash \ that’s at the very end of the line (that’s not inside a table or code block) will also translate into a
tag (the \ is replaced). To keep a literal \ at the end of a line (that’s not inside a table or code block), double it.

If you end a line with three or more spaces then a
tag will be generated instead of the plain
tag.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers), dashes (for second-level headers) and tildes (for third-level headers). For example:

‘s, try to use at least four to avoid being mistaken for strike through text or a

-delimited code block.

An optional matching «overline» may precede the header like so:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered, lettered or roman numeraled) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers or letters (latin or greek) or roman numerals followed by a period or right parenthesis ) :

It’s important to note that the actual numbers (or letters or roman numerals) you use to mark the list do have an effect on the HTML output Markdown produces, but only if you skip ahead and/or change the list marker style.

The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

However, if later list items change the style, an attempt is made to modify the list numbering style for that item which should be effective in just about any browser available today.

Similarly if a list item «skips ahead» an attempt is made to skip the list number ahead which again should be effective in just about any browser available today.

will end up being displayed like this without the [style sheet]:

If you do use lazy list numbering, however, you should still start the list with the number 1 (or letter A or a or roman numeral I or i) or even a higher number if desired and then stick with that number (or letter) for the rest of the items. Since you may only skip forward in the numbering, the items will end up numbered (or «lettered») starting with the value used for the first item.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces.

Attempts to change an unordered list’s style or switch from an ordered list to an unordered list (or vice versa) in mid-list are ignored.

Lists end when the first non-blank, non-indented line (relative to the current list nesting level) is encountered that does not begin with a list marker.

To create two distinct lists when there are only blank lines between the end of the first list and the start of the second, a separator line must be inserted. ([Horizontal rules] work just fine for this).

If desired, an XML-style comment (e.g. ) may be used for this purpose provided it is preceded and followed by at least one blank line.

Any non-list-marker, non-blank, non-indented (relative to the current list nesting level) line may be used for this purpose but the XML-style comment has the advantage of not causing anything extra to be shown when the HTML output is displayed in a browser.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

radiovisual/markdown-for-everyone

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

readme.md

Markdown For Everyone

Markdown is an incredibly simple and hassle-free alternative to HTML. Markdown accomplishes the same thing as HTML, but Markdown uses a simple, easy-to-learn syntax that allows you to add a variety of styling options to your plain-text without all the hassle of opening and closing tags.

Use this cheatsheet as a way of demonstrating specific Markdown features. Because this document was written using Markdown, you can alternatively view this file’s raw plaintext to see more of the specific markdown formatting used in this document.

Note: Markdown used on Github resources differs slightly in its feature set then Markdown used elsewhere, but once you learn the basics of Github-flavored Markdown, you are ready to write Markdown everywhere.

Table of Contents

Headings from h1 through h6 are constructed with a # for each level:

Markdown Syntax

Mark Gruber’s Markdown syntax.

This documentation lays out the syntax of Mark Gruber’s Markdown specifications. It is taken from his site. The content and info is his words, but it is here for convenience.

Overview

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters – including Setext, atx, Textile, reStructuredText,
Grutatext, and EtText – the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Inline HTML

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

The only restrictions are that block-level HTML elements – e.g.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Block Elements

Paragraphs and Line Breaks

A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines. (A blank line is any line that looks like a blank line – a line containing nothing but spaces or tabs is considered blank.) Normal paragraphs should not be indented with spaces or tabs.

The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Yes, this takes a tad more effort to create a
, but a simplistic “every line break is a
” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best – and look better – when you format them with hard breaks.

Headers

Markdown supports two styles of headers, Setext and atx.

Setext-style headers are “underlined” using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Optionally, you may “close” atx-style headers. This is purely cosmetic – you can use this if you think it looks better. The closing hashes don’t even need to match the number of hashes used to open the header. (The number of opening hashes determines the header level.) :

Blockquotes

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.

Unordered lists use asterisks, pluses, and hyphens – interchangably
– as list markers:

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the
items in

tags in the HTML output. For example, this input:

Markdown code block

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

Markdown code block

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

Last Modified: May 23, 2021

In this comprehensive guide, we’ll learn Markdown syntax with examples.

Overview

Markdown is a lightweight markup language that is used to format and style the content of text document. Created by John Gruber in 2004, Markdown is now one of the world’s most popular markup languages.

You write markdown in plain text format, which is easier to read and write for most humans, and then Markdown processor convert the plain text into HTML.

There are many markdown processors available. Markdown syntax and support for elements may slightly differ depending upon which markdown processor is being used.

Let’s learn how to format text using various Markdown syntax with examples:-

Block Elements

Headings

Hash # is used to create headings. The number of hashes denotes the heading level for e.g. ### denotes the third level heading.

Heading 1

Heading 1

Heading 1

Heading 2

Heading 3

Heading 3

Heading 4

Heading 4

Heading 5
Heading 5
Heading 6
Heading 6

✅ Always add space between # and the heading for e.g. # Heading 1 works but #Heading 1 doesn’t.
✅ Headings are supported by all Markdown processors.

Alternate syntax for h1 and h2

Heading 1

Heading 1

Heading 1

Heading 1

Heading 1

Heading 2

Heading 1

Heading 2

Paragraphs

Single Paragraph

A simple line of text in Markdown creates a paragraph.

This is a paragraph

This is a paragraph

Multiple Paragraphs

A blank line is used to separate paragraphs.

I love Markdown.

It’s easier to read and write as compare to HTML.

If a blank line is not used then it is considered as a single paragraph even if the text is in multiple lines.

I love Markdown. It’s easier to read and write as compare to HTML.

Paragraph with line break

To add a line break in a paragraph, end a line with two or more spaces.

I love Markdown.
It’s easier to read and write as compare to HTML.

Note: » › » denotes the space in above example.

❌ Do not indent the paragraph with spaces or tabs. It may render different output by different Markdown processors.
✅ Always keep paragraph left-aligned.
✅ Paragraphs are supported by all Markdown processors.

Ordered List

💡 The numbers don’t have to be in numerical order, but the list should start with the number one i.e. 1.

Nested Ordered List

Nested list items can be created by adding indentation to the line. Each indentation creates a deeper nested level.

❌ You can also use parenthesis 1) instead of period 1. but not recommended, because few markdown processor support this.
✅ Ordered lists are supported by all Markdown processors.

Unordered List
Nested Unordered List

Nested list items can be created by adding indentation to the line. Each indentation creates deeper nested level.

Escape period in ordered and unordered list
Escape dash, asterisk and plus in ordered and unordered list
Definition Lists

Some Markdown processors allow you to create definition lists of terms and their corresponding definitions. To create a definition list, type the term on the first line. On the next line, type a colon : followed by a space and the definition.

MarkdownHTMLOutput
First Term Definition of the first term. Second Term Definition of the second term. Another definition of the second term.

❌ Definition lists are NOT supported by all Markdown processors.

Blockquotes

Blockquotes with single paragraph

Blockquotes is created by adding greater sign > in front of a text.

Blockquotes with multiple paragraphs

Blockquotes can contain multiple paragraphs. Add a greater sign > on the blank lines as well between the paragraphs.

This is a blockquote with two paragraphs. I am first paragraph.

I am second paragraph.

Nested Blockquotes

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional > for each nested level.

Back to the first level.

Back to the first level

Formatted Blockquotes

Blockquotes can be formatted with other elements such as headers, lists, emphasis and code blocks. Not all the elements works though, try them and see yourself.

This is a header

some example code :

✅ Blockquotes are supported by all Markdown processors.

Code Blocks

Code blocks are used to write programming code snippet. You can create a code block by indenting every line of the block by at least 4 spaces or 1 tab

MarkdownHTMLOutput
› › › › function test() <
› › › › › › console.log(«markdown»);
› › › › >

Note: » › » denotes the space in above example.

Fenced Code Blocks

If you find adding 4 spaces or one tab on each line of the block is more inconvenient then some markdown processors also support three backticks «` or three tildes

before and after the code block.

MarkdownHTMLOutput
«`
function test() <
console.log(«markdown»);
>
«`
Syntax Highlighting

Many Markdown processors support syntax highlighting for fenced code blocks. This feature allows you to add color highlighting for whatever language your code was written in. To add syntax highlighting, specify a language next to the three backticks for e.g. «`javascript

Note that syntax highlighting support for a language and how the syntax are displayed for that language varies across different Markdown processors. You can try from this full list of languages, if that works for you:-

✅ Code block (without Syntax highlighting) is supported by all Markdown processors.
❌ Code blocks with Syntax highlighting is NOT supported by all Markdown processors.

Horizontal Rules

produce a horizontal rule like below:-

✅ Horizontal rules are supported by all Markdown processors.

Tables

MarkdownHTMLOutput
Header 1Header 2
Cell 11Cell 12
Cell 21Cell 22

You can optionally add pipes on either end of the table.

MarkdownOutput
Header 1Header 2
Cell 11Cell 12
Cell 21Cell 22
MarkdownOutput
Header 1Header 2
Cell 11Cell 12
Cell 21Cell 22
Table Column Text Alignment

You can align text in the columns to the left, right, or center by adding a colon : to the left, right, or on both side of the hyphens within the header row.

Text AlignSyntax
left:—
center:—:
right—:
MarkdownOutput
IndexStationary ItemAmount
1.Pencil10.00
2.Notebook120.00
Table Cell Text Formatting

You can format the text within table cells. For example, you can add links, code (not code blocks), and emphasis. You can’t add headings, blockquotes, lists, horizontal rules, images, or HTML tags.

MarkdownOutput
Header 1Header 2
boldhttps://example.com
italiccode
Escape Pipe in Tables

If you want to use | character as a text in the table then you can escape it with blackslash i.e. \|

MarkdownOutput
IndexStationary Item
|1|Pencil | Pen
|2|Notebook

❌ Tables are NOT supported by all Markdown processors.

Task Lists

Task lists allow you to create a list of items with checkboxes. In Markdown applications that support task lists, checkboxes will be displayed next to the content.

MarkdownOutput
Task 1 Completed
Task 2 in Progress
Task 3 Pending

❌ Task lists are NOT supported by all Markdown processors.

Span Elements

Emphasis

Add two asterisks ** or two underscores __ before and after a word for e.g. **bold** or __bold__ to render as bold.

MarkdownHTMLOutput
I am **bold**I am boldI am bold
I am __bold__I am boldI am bold
I am **bold and stong**I am bold and strongI am bold and strong
I am __bold and stong__I am bold and strongI am bold and strong

You can only use asterisks ** and not underscores __ to make part of the word bold. Using __ in part of the word considered as underscore _ and not syntax.

MarkdownHTMLOutput
I am half**bold**I am halfboldI am halfbold
I am half__bold__I am half__bold__I am half__bold__
Italic

Add an asterisk * or underscore _ before and after a word for e.g. *italic* or _italic_ to render as italic.

MarkdownHTMLOutput
I am *italic*I am italicI am italic
I am _italic_I am italicI am italic
I am *italic and stylish*I am italic and stylishI am italic and stylish
I am _italic and stylish_I am italic and stylishI am italic and stylish

You can only use asterisk * and not underscores _ to make part of the word italic. Using _ in part of the word considered as underscore _ and not syntax.

MarkdownHTMLOutput
I am half*italic*I am halfitalicI am halfitalic
I am half_italic_I am half_italic_I am half_italic_

✅ Italic is supported by all Markdown processors.

Strikethrough

before and after a word for e.g.

I am strikeI am strike
I am

strike and through

I am strike and throughI am strike and through
I am strike

I am strike throughI am strike through

❌ Strikethrough is NOT supported by all Markdown processors.

Bold, Italic and Strike

together for e.g. **_

bold, italic, and strike

_** to render bold, italic and strike at the same time.

MarkdownHTMLOutput
I am ***bold and italic***I am bold and italicI am bold and italic
I am ___bold and italic___I am bold and italicI am bold and italic
I am __*bold and italic*__I am bold and italicI am bold and italic
I am **_bold and italic_**I am bold and italicI am bold and italic
I am bold, italic, and strike
I am bold, italic, and strike
Escape asterisk, underscore and tilde in emphasis

characters to use them in literal way by adding a backslash \ in front of that character.

in Strike

MarkdownHTMLOutput
**Escape \* in Bold**Escape * in BoldEscape * in Bold
_Escape \_ in Italic_Escape _ in ItalicEscape _ in Italic
Escape

Inline Link
MarkdownHTMLOutput
[example link](http://example.com/)example link
Inline Link with Title

Inline Link can also be created with optional title which is displayed when hover on the link.

Inline Link with URL and Email Address

URL or email address can quickly be turned into a clickable link by wrapping it in angle brackets <>

Automatic URL and Email Address Link

💡 Many markdown processors (but not all) automatically turns URL and Email Address into clickable link even without wrapping in <>

MarkdownHTMLOutput
https://example.comhttp://example.com
fake@example.comhttp://example.com
Reference Links

Reference-style links are constructed in two parts: first part is link text which you keep inline and the second part is URL which you define somewhere else in the document.

I get 10 times more traffic from Google than from Yahoo or MSN.

Image

Inline Image
Inline Image with Title
Inline Image with Link

Clickable image can also be created with link URL for e.g. [![alt-text](image-path «Title»)](URL)

Reference Image

Reference-style images are constructed in two parts: first part is alt text which you keep inline and the second part is image patg which you define somewhere else in the document.

✅ Images are supported by all Markdown processors.

MarkdownHTMLOutput
execute command `nano`execute command nanoexecute command nano
Escape backticks in code
MarkdownHTMLOutput
execute command « `nano` «execute command `nano`execute command `nano`

Escaping Characters

Sometime we want to display the characters in literal way which are used as a Markdown syntax. In such cases, add a backslash \ in front of the character.

You can escape the following characters in Markdown:-

CharacterExample
*see escape asterisk in bold and italic
see escape asterisk in ordered and unordered list
_see escape underscore in bold and italic
see escape tilde in strikethrough
`see escape backticks in code
.see escape period (dot) in ordered and unordered list
|see escape pipe in tables
see escape hyphen (dash) in ordered and unordered list
+see escape plus in ordered and unordered list
<>curly braces
[]brackets
<>angle brackets
()parentheses
#hash (pound)
!exclamation
\backslash

Summary

Congratulations! We have learned all the syntax supported by most of the Markdown processors.

You can further read following useful resources:-

jonschlinkert / markdown-cheatsheet.md

(Also see remarkable, the markdown parser created by the author of this cheatsheet)

Table of contents

The following markdown features are defined by the CommonMark standard, and are generally supported by all markdown parsers and editors.

Headings from h1 through h6 are constructed with a # for each level:

Renders to this HTML:

Which looks like this in the browser:

A note about «Setext» Headings

Note that this document only describes ATX headings, as it is the preferred syntax for writing headings. However, the CommonMark specification also describes Setext headings, a heading format that is denoted by a line of dashes or equal signes following the heading. It’s recommended by the author of this guide that you use only ATX headings, as they are easier to write and read in text editors, and are less likeley to conflict with other syntaxes and demarcations from language extensions.

Body copy written as normal plain-text will be wrapped with

tags in the rendered HTML.

Renders to this HTML:

You can use multiple consecutive newline characters ( \n ) to create extra spacing between sections in a markdown document. However, if you need to ensure that extra newlines are not collapsed, you can use as many HTML
elements as you want.

The HTML element is for creating a «thematic break» between paragraph-level elements. In markdown, you can use of the following for this purpose:

For emphasizing a snippet of text with a heavier font-weight.

The following snippet of text is rendered as bold text.

rendered as bold text

For emphasizing a snippet of text with italics.

The following snippet of text is rendered as italicized text.

rendered as italicized text

Used for defining a section of quoting text from another source, within your document.

To create a blockquote, use > before any text you want to quote.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

And the generated HTML from a markdown parser might look something like this:

Blockquotes can also be nested:

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.

Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.

Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi.

A list of items in which the order of the items does not explicitly matter.

You may use any of the following symbols to denote bullets for each list item:

A list of items in which the order of items does explicitly matter.

Sometimes lists change, and when they do it’s a pain to re-order all of the numbers. Markdown solves this problem by allowing you to simply use 1. before each item in the list.

Automatically re-numbers the items and renders to:

For example, to show

«Fenced» code block

For example, this:

Renders to something like this in HTML:

And appears like this when viewed in a browser:

You may also indent several lines of code by at least four spaces, but this is not recommended as it is harder to read, harder to maintain, and doesn’t support syntax highlighting.

Which renders to:

And this complicated HTML is an example of what might be generated by the markdown parser, when syntax highlighting is applied by a library like highlight.js:

URIs or email addresses that are not wrapped in angle brackets are not recognized as valid autolinks by markdown parsers.

Renders to (hover over the link, there is no tooltip):

Renders to (hover over the link, there should be a tooltip):

Named anchors enable you to jump to the specified anchor point on the same page.

For example, the following «chapter» links:

. will jump to these sections:

Anchor placement

Note that placement of achors is arbitrary, you can put them anywhere you want, not just in headings. This makes adding cross-references easy when writing markdown.

Images have a similar syntax to links but include a preceding exclamation point.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Like links, Images also have a footnote style syntax

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

With a reference later in the document defining the URL location:

Any text between and > that looks like an HTML tag will be parsed as a raw HTML tag and rendered to HTML without escaping.

(Note that markdown parsers do not attempt to validate your HTML).

Escaping with backslashes

Any ASCII punctuation character may be escaped using a single backslash.

*this is not italic*

The following markdown features are not defined by the CommonMark specification, but they are commonly supported by markdown parsers and editors, as well as sites like GitHub and GitLab.

In GitHub Flavored Markdown (GFM) you can do strickthroughs.

Which renders to:

Strike through this text.

Links in todo lists

Tables are created by adding pipes as dividers between each cell, and by adding a line of dashes (also separated by bars) beneath the header (this line of dashes is required).

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Center text in a column

To center the text in a column, add a colon to the middle of the dashes in the row beneath the header.

Right-align the text in a column

To right-align the text in a column, add a colon to the middle of the dashes in the row beneath the header.

OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.

Markdown footnotes are not officially suppored by the CommonMark specification. However, the feature is supported by remarkable and other markdown parsers, and it’s very useful when available.

The accompanying text for the footnote can be added elsewhere in the document using the following syntax:

When rendered to HTML, footnotes are «stacked» by the markdown parser at the bottom of the file, in the order in which the footnotes were defined.

What is markdown?

Sites like GitHub and Stackoverflow have popularized the use markdown as a plain-text alternative to traditional text editors, for writing things like documentation and comments.

All contributions are welcome!

Please let me know if you find typos, grammar or spelling mistakes, or have a suggestion for improving the cheatsheet (since GitHub does not send notifications for gists, it might be better to contact me on twitter, at @jonschlinkert).

How to include code in docs

There are several ways other than screenshots to include code in an article published on docs.microsoft.com:

Individual elements (words) within a line.

Here’s an example of code style.

Use code format when referring to named parameters and variables in a nearby code block in your text. Code format may also be used for properties, methods, classes, and language keywords. For more information, see Code elements later in this article..

Code blocks in the article Markdown file.

Use inline code blocks when it’s impractical to display code by reference to a code file. For more information, see Code blocks later in this article.

Code blocks by reference to a code file in the local repository.

For more information, see In-repo snippet references later in this article.

Code blocks by reference to a code file in another repository.

For more information, see Out-of-repo snippet references later in this article.

Code blocks that let the user execute code in the browser.

For more information, see Interactive code snippets later in this article.

Besides explaining the Markdown for each of these ways to include code, the article provides some general guidance for all code blocks.

Code elements

A «code element» is a programming language keyword, class name, property name, and so forth. It’s not always obvious what qualifies as code. For example, NuGet package names should be treated as code. When in doubt, see Text formatting guidelines.

Inline code style

To include a code element in article text, surround it with backticks (`) to indicate code style. Inline code style shouldn’t use the triple-backtick format.

MarkdownRendered
By default, the Entity Framework interprets a property that’s named `Id` or `ClassnameID` as the primary key.By default, the Entity Framework interprets a property that’s named Id or ClassnameID as the primary key.

When an article is localized (translated into other languages), text styled as code is left untranslated. If you want to prevent localization without using code style, see Non-localized strings.

Bold style

Some older style guides specify bold for inline code. Bold is an option when code style is so obtrusive as to compromise readability. For example, a Markdown table with mostly code elements might look too busy with code styling everywhere. If you choose to use bold style, use non-localized strings syntax to make sure that code is not localized.

Links

A link to reference documentation may be more helpful than code format in some contexts. If you use a link, don’t apply code format to the link text. Styling a link as code can obscure the fact that the text is a link.

If you use a link and refer to the same element later in the same context, make the subsequent instances code format rather than links. For example:

The first reference to System.CommandLine in this text is a link. Subsequent references to System.CommandLine can be in code style.

Placeholders

If you want the user to replace a section of displayed code with their own values, use placeholder text marked off by angle brackets. For example:

You may note that the brackets must be removed when substituting real values. The Microsoft Writing Style Guide calls for italics, which you may format within angle bracketed inline code:

Curly braces < >are discouraged for use as syntactical placeholders. They may be confused with the same notation used in replaceable text, format strings, string interpolation, text templates, and similar programming constructs.

Placeholder names can be separated by hyphens («kebab case»), with underscores, or not separated at all (Pascal case). Kebab case may generate syntax errors and underscores may conflict with underlining. All-caps may conflict with named constants in many languages, though it may also draw attention to the placeholder name.

Code blocks

The syntax for including code in a doc depends on where the code is located:

Following are guidelines that apply to all three types of code blocks:

Screenshots

All of the methods listed in the preceding section result in usable code blocks:

These are just a few of the reasons why IDE screenshots aren’t recommended as a method of including code in an article. Use IDE screenshots for code only if you’re showing something about the IDE itself, like IntelliSense. Don’t use screenshots just to show colorization and highlighting.

Code validation

If you are including code blocks from another repository, work with the owners on a maintenance strategy for the code so that your included code does not break or go out of date as new versions of the libraries the code uses are shipped.

Highlighting

Snippets typically include more code than necessary in order to provide context. It helps readability when you highlight the key lines that you’re focusing on in the snippet, as in this example:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

You can’t highlight code when you include it in the article Markdown file. It works only for code snippets included by reference to a code file.

Horizontal scroll bars

Break up long lines to avoid horizontal scroll bars. Scroll bars on code blocks make code hard to read. They’re especially problematic on longer code blocks, where it may be impossible to see the scroll bar and the line you want to read at the same time.

A good practice for minimizing horizontal scroll bars on code blocks is to break up code lines longer than 85 characters. But keep in mind that the presence or absence of a scroll bar isn’t the only criterion of readability. If breaking a line before 85 hurts readability or copy-paste convenience, feel free to go over 85.

Clearly identify bad code

In some scenarios, it’s helpful to point out coding patterns that should be avoided, for example:

For these scenarios:

Explain the error both in code comments and article text.

Readers often skip article text and look only at code, so it’s not enough to explain the error only in article text. It’s also not enough to explain the error only in code comments, because code comments aren’t localized.

Consider commenting out the code if it would cause a compiler error.

Commented-out code won’t disrupt the continuous integration (CI) system if the article’s repo has one now or implements one in the future.

Inline code blocks

Use inline code blocks only when it’s impractical to display code by reference to a code file. Inline code is generally more difficult to test and keep up to date compared to a code file that is part of a complete project. And inline code may omit context that could help the developer to understand and use the code. These considerations apply mainly to programming languages. Inline code blocks can also be used for outputs and inputs (such as JSON), query languages (such as SQL), and scripting languages (such as PowerShell).

There are two ways to indicate a section of text in an article file is a code block: by fencing it in triple-backticks («`) or by indenting it. Fencing is preferred because it lets you specify the language. Avoid using indentation because it’s too easy to get wrong and it may be hard for another writer to understand your intent when they need to edit your article.

Language indicators are placed immediately after the opening triple-backticks, as in the following example:

GitHub Flavored Markdown supports delimiting code blocks with tildes (

) as well as with backticks (`). The symbol used to open and close the code block must be consistent within the same code block.

For information about the values you can use as language indicators, see Language names and aliases.

If you use a language or environment word after the triple-backticks («`) that isn’t supported, that word appears in the code section title bar on the rendered page. Whenever possible, use a language or environment indicator in your inline code blocks.

If you copy and paste code from a Word document, make sure it has no «curly quotes,» which aren’t valid in code. If it does, change them back to normal quotes ( ‘ and » ). Alternatively, rely on the Docs Authoring Pack, smart quotes replacement feature.

In-repo snippet references

The preferred way to include code snippets for programming languages in docs is by reference to a code file. This method gives you the ability to highlight lines of code and makes the wider context of the snippet available on GitHub for developers to use. You can include code by using the triple colon format (. ) either manually or in Visual Studio Code with the help of the docs.microsoft.com Authoring Pack.

Display entire code file:

Display part of a code file by specifying line numbers:

Display part of a code file by specifying a snippet name:

The following sections explain these examples:

For more information, see Snippet syntax reference later in this article.

Path to code file

The example is from the ASP.NET docs repo, aspnetcore/data/ef-mvc/crud.md article file. The code file is referenced by a relative path to aspnetcore/data/ef-mvc/intro/samples/cu/Controllers/StudentsController.cs in the same repository.

Selected line numbers

This example displays only lines 2-24 and 26 of the StudentController.cs code file.

Prefer named snippets over hard-coded line numbers, as explained in the next section.

Named snippet

Use only letters and underscores for the name.

The example displays the snippet_Create section of the code file. The code file for this example has snippet tags in comments in the C# code:

Named code snippets can be nested, as shown in the following example:

When the Method code snippet is rendered, the Line tags aren’t included in the rendered output.

Whenever you can, refer to a named section rather than specifying line numbers. Line number references are brittle because code files inevitably change in ways that make line numbers change. You don’t necessarily get notified of such changes. Your article eventually starts showing the wrong lines and you have no clue anything has changed.

Highlighting selected lines

The example highlights lines 2 and 5, counting from the start of the displayed snippet. Line numbers to highlight don’t count from the start of the code file. In other words, lines 3 and 6 of the code file are highlighted.

Out-of-repo snippet references

If the code file you want to reference is in a different repository, set up the code repository as a dependent repository. When you do that, you specify a name for it. That name then acts like a folder name for purposes of code references.

For example, the docs repository is Azure/azure-docs, and the code repository is Azure/azure-functions-durable-extension.

In the root folder of azure-docs, add the following section in .openpublishing.publish.config.json:

Now when you refer to samples-durable-functions as if it were a folder in azure-docs, you’re actually referring to the root folder in the azure-functions-durable-extension repository.

You can include code by using the triple colon format (. ) either manually or in Visual Studio Code with the help of the docs.microsoft.com Authoring Pack.

Your snippet reference will look like this:

In the azure-functions-durable-extension repository, that code file is in the samples/csx/shared folder. As noted earlier, line numbers for highlighting are relative to the start of the snippet rather than the start of the file.

The name you assign to the dependent repository is relative to the root of the main repository, but the tilde (

/../samples-durable-functions instead of

Snippets in a Jupyter notebook

You can reference a cell in a Jupyter notebook as a code snippet. In order to reference the cell:

Add metadata to notebook

Name the cell by adding cell metadata in the Jupyter notebook.

In the cell metadata, add a «name» attribute:

You can add any other metadata you’d like to help you track where the cell is being used. For example:

Set up repository access

If the notebook file you want to reference is in a different repository, set up the code repository as a dependent repository.

Jupyter notebook snippet syntax reference

Once your notebook contains the required metadata, reference it in your markdown file. Use the you added to the notebook, and the

you set up as your dependent repository.

This syntax is a block Markdown extension. It must be used on its own line.

Use any of the supported languages for the identifier.

Interactive code snippets

Inline interactive code blocks

For the following languages, code snippets can be made executable in the browser window:

When interactive mode is enabled, the rendered code boxes have a Try It or Run button. For example:

renders as follows:

To turn on this feature for a particular code block, use a special language identifier. The available options are:

For the Azure Cloud Shell and PowerShell Cloud Shell, users can run commands against only their own Azure account.

Code snippets included by reference

You can enable interactive mode for code snippets included by reference. To turn on this feature for a particular code block, use the interactive attribute. The available attribute values are:

Here are some examples:

For the Azure Cloud Shell and PowerShell Cloud Shell, users can only run commands against their own Azure account.

Snippet syntax reference

This syntax is a block Markdown extension. It must be used on its own line.

Supported languages

The Docs Authoring Pack includes a feature to provide statement completion and validation of the available language identifiers for code fence blocks.

Fenced code blocks

The Docs Authoring Pack, Dev Lang Completion feature uses the first valid alias when multiple aliases are available.

Next steps

For information on text formatting for content types other than code, see Text formatting guidelines.

Bitbucket Support

Knowledge base

Products

Jira Software

Project and issue tracking

Jira Service Management

Service management and customer support

Jira Core

Manage any business project

Confluence

Bitbucket

Git code management

Resources

Documentation

Usage and admin help

Community

Answers, support, and inspiration

Suggestions and bugs

Feature suggestions and bug reports

Marketplace

Billing and licensing

Frequently asked questions

Viewport

Confluence

Versions

Markdown syntax guide

Use Bitbucket Data Center and Server

On this page

Related content

Still need help?

The Atlassian Community is here for you.

Bitbucket Data Center and Server uses Markdown for formatting text, as specified in CommonMark (with a few extensions). You can use Markdown in the following places:

Use Control-Shift-P or Command-Shift-P to preview your markdown.

Markdown syntax

The page below contains examples of Markdown syntax. For a full list of all the Markdown syntax, consult the CommonMark help or specification.

On this page:

Headings

Paragraphs

Paragraphs are separated by empty lines. To create a new paragraph, press twice.

Character styles

Unordered list

Ordered list

List in list

Quotes or citations

Inline code characters

Code blocks

Bitbucket uses CodeMirror to apply syntax highlighting to the rendered markdown in comments, READMEs and pull request descriptions. All the common coding languages are supported, including C, C++, Java, Scala, Python and JavaScript. See Configuring syntax highlighting for file extensions.

Within a code block, ampersands (&) and angle brackets ( ) are automatically converted into HTML entities.

Links to external websites

Linking issue keys to JIRA applications

When you use Jira application issue keys (of the default format) in comments and pull request descriptions Bitbucket automatically links them to the Jira application instance.

The default Jira application issue key format is two or more uppercase letters ( [A-Z][A-Z]+ ), followed by a hyphen and the issue number, for example TEST-123.

Linking to pull requests

Introduced with Bitbucket 4.9, you can reference pull requests from comments and descriptions in other pull requests. The syntax for linking to pull request looks like this:

To link to a pull request in the same project and repository, you only need to include the pull request ID.

To link to a pull request in the same project but a different repository, include the repository slug before the pull request ID.

To link to a pull request in a different project and repository, include the project key and the repository slug before the pull request ID.

Images

Inline image syntax looks like this:

Reference image links look like this:

Where ‘id’ is the name of a previously defined image reference, using syntax similar to link references:

An example using reference image links:

You can specify image height and width as key=value pairs inside curly braces < >after the applicable image node. For example:

Tables

Backslash escapes

Certain characters can be escaped with a preceding backslash to preserve the literal display of a character instead of its special Markdown meaning. This applies to the following characters:

\ backslash
` backtick
* asterisk
_ underscore
<> curly braces
[] square brackets
() parentheses
# hash mark
> greater than
+ plus sign
— minus sign (hyphen)
. dot
! exclamation mark

Markdown Basic Syntax

In this article you will learn about the elements that form the basis of the Markdown language.

Overview

Despite some variations, most applications support the basic elements of Markdown. These elements are essential for you to be able to format a document. But make no mistake, using only the basics of Markdown you can create well-designed sites for Web.

NOTE: Whenever possible, when there are syntax variations from one Markdown processor to another, these will be noted in the article.

Titles

Every document has or should have a title, correct? So, let’s start with it.

The symbol used to format a title in Markdown is the hash # one. When building the title, format the code by placing a hash at the beginning of the line, demarcating the header.

It will be converted to HTML’s h1 tag.

photo Title H1 in Markdown converted to HTML

NOTE: the h1 tag represents the most important title of the HTML, usually the title of the article.

The number of hashes that you use at the beginning of the line indicates the level of the title, therefore, the formatting ### My title creates a level 3 heading.

photo Markdown Titles on StackEdit

Alternative syntax

photo Alternative syntax for creating level 1 and level 2 headings

photo Alternative syntax for headings using only one sign

Titles: best practices

You may encounter compatibility issues when we talk about the space between the hash sign # at the beginning of the line and the title text.

It is always recommended to add at least one space between them, in addition to providing a better reading of your document, you will still have more editing support among the Markdown applications.

Table 1.3 exemplifies the correct construction of the title.

photo Building a title in Markdown the right way

Paragraphs

The simplest formatting in Markdown is the paragraph. To create one, simply separate a piece of text with a blank line, creating fragmentations that the Markdown processor will interpret as paragraphs.

photo Paragraphs in Markdown

Markdown is important for every programmer.

Learning Markdown is essential for a successful career.

Paragraphs: best practices

Usually the paragraph is stuck at the beginning of the line, that is, avoid indenting it using spaces of any kind, neither blanks nor tabs.

NOTE: The paragraph must be indented when it is within a list.

Table 1.5 exemplifies the correct use of Markdown formatting for constructing a paragraph.

Right

Not recommended

Do not use blanks or tabs in front of paragraphs.

The paragraph must be aligned to the left.

These spaces can cause formatting problems depending on the Markdown application.

Line breaks

In HTML a line break is represented by the br tag.

photo Line break in HTML

To generate a line break in Markdown, insert two or more blank spaces at the end of the line and press the Enter key.

First line of the document.
Second line of the document.

Line break: best practices

The use of white space to create line breaks, although compatible with most applications, can cause formatting problems.

Here are some points:

A viable alternative to avoid any problems with line breaks is to use the HTML br tag directly in your documents.

NOTE: It is interesting to remember that most Markdown applications are also compatible with HTML tags, that is, you can merge Markdown formatting with HTML formatting in the same document.

NOTE: In some applications, just pressing the Enter key is enough to create a line break

NOTE: Variations of Markdown, such as CommonMark, interpret the use of a backslash \ as an indicator of a new line.

Table 1.7 shows the correct syntax for creating a new line.

Right

Not recommended

Two spaces after the line.
New line inserted.

Using HTML tag to break the line.

New line inserted.

Using the backslash to break the line.\
New line inserted.

Breaking the line using the Enter key. Enter
New line inserted.

Emphasis

Similar to a WYSIWYG editor, like Microsoft Word, Markdown also offers formatting to emphasize the text.

photo Formatting emphasis in Microsoft Word

Among the most popular emphasis formats are bold and italics, which can also be applied using the Markdown syntax.

Bold in Markdown

To bold a text in Markdown, place two asterisks ** before the content and two asterisks ** after the content.

photo Bold in Markdown

NOTE: As shown in the examples above, you can replace asterisks with underscores, using two underscores __ before and after the content also bolds the text in Markdown.

Bold: best practices

Both the use of two asterisks and the use of two underscores can apply bold formatting to content.

However, the use of underscores in the middle of a word can lead to formatting problems depending on the Markdown processor, therefore, it’s best to use asterisks in this case.

Table 1.9 demonstrates the recommended use of Markdown formatting to bold in between text.

photo Bold in the middle of the content

Italics in Markdown

photo Syntax of italic formatting in Markdown

To italicize the middle of a word in Markdown, use an asterisk before and after the content.

Italics: best practices

Always use an asterisk * when italicizing the middle of a word, this will avoid compatibility problems with Markdown processors.

Table 1.11 shows the recommended markup to italicize the middle of the content.

Bold and Italic

photo Bold and italics in Markdown

Only bold or only italics? If you want, you can combine the two formats to highlight any content.

To apply bold and italics simultaneously, add three asterisks *** or three underscores ___ around the text to be highlighted.

Bold and Italics: best practices

To avoid compatibility problems with Markdown applications, when highlighting the middle of a word, combining bold and italics, give preference to the use of three asterisks.

photo Recommended syntax for applying bold and italics in Markdown.

Table 1.13 demonstrates the indicated formatting to combine bold and italics.

Blockquote

To mark content as blockquote in Markdown, use the greater than sign > at the beginning of the paragraph.

photo Blockquote in Markdown.

For example, this Markdown tag:

Would result in this HTML output:

Blockquote with multiple paragraphs

If you need a blockquote containing several paragraphs within it, use the greater than sign > in front of each of these paragraphs and separate them by a line containing only the greater than sign.

photo Blockquote with multiple paragraphs

NOTE: The greater than sign > must be placed on the line that separates the paragraphs, doing so the Markdown processor can interpret your markup correctly.

Let’s look at an example:

The output in HTML:

First paragraph of the blockquote.

Second paragraph of the blockquote.

Nested Blockquotes

In addition to inserting several paragraphs within a blockquote you can also nest them, that is, inserting blockquotes within blockquotes, complex? Let’s simplify.

To create a nested block use two greater than signs >> before the paragraph.

Rendering in HTML:

This paragraph will be interpreted as a nested blockquote.

Blockquote with other elements

The versatility of blockquotes allows the insertion of other Markdown elements within them.

NOTE: Some Markdown elements may not be rendered correctly when placed inside a blockquote, this varies greatly between Markdown processors.

The output in HTML:

H4 title within the block

Italic text part of the paragraph without formatting bold text.

Lists

Lists are essential in organizing topics in your document. A list facilitates the visualization of elements that may be related to each other.

Ordered lists

Let’s start by ordering the elements of our list, for that we put a number followed by a period and the text of the element.

NOTE: To create an indented element, insert a tab before the number that marks the element. In some Markdown processors you can also insert 3 spaces before numbering, the result is similar, but this can vary depending on the application, when in doubt use TAB.

Unordered lists

An unordered list is a sequence of elements denoted usually by some symbol to the left of the element, there is no numerical sequence here.

Place one of these three signs before the list item to demarcate it, followed by a blank space and the content of the element.

NOTE: Indent an element in the list by inserting a tab before the element markup.

Adding elements

Markdown allows you to insert other elements in the middle of a list without breaking its continuity.

To preserve the formatting of the list, indent the different element by 4 spaces or a tab.

Paragraphs

The result would be this:

A paragraph added without breaking the list continuity.

Blockquote within the list

The result would look like this:

This is the second element on the list.

Blockquote in the middle of the list.

Code block

When inserting a code block in a list, indent it eight spaces or two tabs.

Below is an example of a list with a code block inside it.

The result looks like this:

Locate the code block shown below:

Note that the numerical sequence of the list has not changed even with the insertion of the code block between the elements.

Images

Rendering in HTML would look like this:

See the Markdown logo on the screen.

Escaping backticks

You may encounter the following situation.

The content to which you intend to apply the code formatting already contains a backtick. Or if you want to use the backtick to highlight part of the text within the code itself.

Translating, you need to place a backtick inside a code demarcation without this backtick being interpreted as Markdown markup.

The solution is simple, duplicate the initial and the final backtick that surround the piece of code.

Using `backtick` within the code markup.

Code block

Markdown allows us to create code blocks by indenting the content 4 spaces or a tab.

See the following example:

Using Markdown’s extended syntax we can create code blocks without indenting spaces, for that we need to use the fenced code blocks formatting.

Horizontal rules

A line must contain only those characters for the Markdown processor to interpret the horizontal rule correctly.

Using any of the characters the result will be the same, see below.

NOTE: It is not necessary to stipulate a maximum number of characters to create a line, as long as you use at least 3 and the line only has these characters, you can enter as many as you want.

Horizontal rules: best practices

Table 1.18 exemplifies the creation of horizontal rules in the correct way.

Right

Not recommended

The world is flat.

Always put a blank line before creating a horizontal rule.

Links

Links are used to create connections between parts of your document. When it comes to creating a page for Web or even PDF files, being able to insert links is one of the indispensable features for editing these types of documents.

The basic syntax for creating links in Markdown is as follows:

Putting it all together.

And the output in HTML.

Adding titles

If you have a little experience with HTML you know that when the user places the mouse pointer over a link on the page, usually a small label describing the purpose of the link pops-up.

This label is what we call the title of link and to create it using Markdown just add inside the parentheses a text in quotes after the URL.

Output in HTML, place the mouse over the link and see the title appear.

URLs and email addresses

You can also turn a URL into a link automatically by placing it between less than and greater than > signs.

The result looks like this:

Emphasizing links

By adding asterisks around the link formatting, meaning, before the brackets and after the parentheses, you indicate to the Markdown processor that the link should be emphasized.

The output in HTML would look like this:

Visit website: Markdown reference
I recommend the search engine: Duck Duck GO.

You can also highlight a link using code formatting.

Review the section: code

Reference style Links

Markdown offers an alternative syntax for creating links that allows a cleaner view of your document.

With this syntax you can place the text that will be transformed into link in the middle of the paragraph with just one reference, at the end of the document add all links using the same references you created before.

NOTE: You can place the link reference anywhere in your document, I recommend it at the end for organization reasons.

As the creation of this reference link is divided into two parts, we will analyze each one of them.

First part of link

First we will create two sets of square brackets, inside the first place the text of the link, that is the text that will appear on the page, in the second place a label that will serve as a reference for the address of the link:

NOTE: The reference link label, placed inside the second pair of brackets, can be anything, numbers, words, phrases, can even include punctuation, it is up to you, as long as the reference to the link at the end of the document is the same.

NOTE: The reference label is also not case sensitive, ie wiki_markdown is the same as WIKI_MARKDOWN.

Second part of link

The second part indicates where that link points to, or to be specific, the link’s URL.

To assemble the second part of the link we have to have the following:

All the examples below are valid formattings for the second part of the link:

I will emphasize again that you can place this second part of the link anywhere in your document, I add it at the end of the file for organization reasons

Putting all the pieces together

Here I will present you a situation where the use of reference links can keep your Markdown document easier to read.

Say you need to add one or more links to a website with more information about the content covered in that paragraph.

In Markdown it would look like this:

Note that adding links within the paragraph itself can make the text more difficult to read, especially if the person reading it does not know Markdown.

Since the links are important for the context of the paragraph, we cannot remove them, however there is a more effective way to clean up that paragraph using reference links.

NOTE: Placing the less than and greater than > signs around the link is optional.

The two formats above will have similar results in HTML:

To learn more you can consult this Markdown article: Wikipedia. Or the language documentation: John Gruber.

Reference Links: best practices

In some cases, you may encounter blank space in URLs, this can become a problem depending on the Markdown application.

Table 1.19 shows the formatting of white space in URL using encoding.

Images

The Markdown syntax for adding an image is as follows:

The conversion to HTML looks like this:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Image and Link

To use an image as link:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Escaping characters

To escape a character in Markdown, that is, to represent it literally in the document, insert a backslash before it.

The result looks like this:

* The backslash before the asterisk causes the Markdown processor to interpret this line as a paragraph and not an element of a list.

Characters you can escape

HTML and Markdown

Programmers who already have experience in HTML, sometimes mix the two syntaxes in the same document, that is, HTML and Markdown.

HTML can be useful in tasks like changing attributes of elements of your document such as colors, location, size, etc.

Place the HTML tags directly in your document.

The result looks like this:

HTML and Markdown: best practices

It is important to note that not all Markdown processors are compatible with the HTML tags, in some cases, they support only a subset of these tags.

Trial and error can be a strategy. Try to format content using tags and check if the output in HTML is as expected, or of course, consult the application’s documentation.

Do not indent the tags line in HTML, neither with blanks nor with tabs, this can interfere with the formatting of the element when converted.

Insert a blank line before and after block elements like:

Markdown Guide markdown-guide

Philosophy

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Block Elements

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Headers

Markdown supports two styles of headers, Setext and atx.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Blockquotes

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

Syntax guidance for basic Markdown usage

Azure DevOps Services | Azure DevOps Server 2022 | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

To view the content available for your platform, make sure that you select the correct version of this article from the version selector which is located above the table of contents. Feature support differs depending on whether you are working from Azure DevOps Services or an on-premises version of Azure DevOps Server, renamed from Team Foundation Server (TFS).
To learn which on-premises version you are using, see What platform/version am I using?

Here you can find some basic Markdown syntax guidance and specific guidance for using Markdown in Azure DevOps features. You can use both common Markdown conventions and GitHub-flavored extensions.

Having the right guidance at the right time is critical to success. Use Markdown to add rich formatting, tables, and images to your project pages, README files, dashboards, and pull request comments.

For more syntax that’s supported for Wiki pages, see Wiki Markdown guidance.

You can provide guidance in the following areas using Markdown:

Rich Markdown rendering in code repositories is supported for TFS 2018.2 and later versions. You can create rich README.md files in the code repositories. The Markdown rendering of the MD files in code repositories supports HTML tags, block quotes, emojis, image resizing, and mathematical formulas. There is parity in Markdown rendering in Wiki and MD files in code.

Not all Markdown syntax is supported across all features. Each section in this article identifies the features the syntax is supported with the Supported in line.

Headers

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Structure your comments using headers. Headers segment longer comments, making them easier to read.

Example:

Result:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Paragraphs and line breaks

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Make your text easier to read by breaking it into paragraphs or with line breaks.

Pull requests

In pull request comments, select Enter to insert a line break, and begin text on a new line.

Result:

Add lines between your text with the Enter key.

Your text gets better spaced and makes it easier to read.

Markdown files or widgets

In a Markdown file or widget, enter two spaces before the line break, and then select Enter to begin a new paragraph.

Result:

Add two spaces before the end of the line, and then select Enter.

A space gets added in between paragraphs.

Blockquotes

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Quote previous comments or text to set the context for your comment or text.

Quote single lines of text with > before the text. Use many > characters to nest quoted text. Quote blocks of lines of text by using the same level of > across many lines.

Example:

Result:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Horizontal rules

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Example:

Result:

Emphasis (bold, italics, strikethrough)

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

You can emphasize text by applying bold, italics, or strikethrough to characters:

Combine these elements to apply emphasis to text.

There is no Markdown syntax that supports underlining text. Within a wiki page, you can use the HTML tag to generate underlined text. For example, underlined text yields underlined text.

There is no Markdown syntax that supports underlining text. Within a wiki page in TFS 2018.2 and later versions, you can use the HTML tag to generate underlined text. For example, underlined text yields underlined text.

Example:

Result:

Use emphasis in comments to express strong opinions and point out corrections
Bold, italicized text Bold, strike-through text

Code highlighting

Supported in: Pull Requests | README files | Wikis

Highlight suggested code segments using code highlight blocks. To indicate a span of code, wrap it with three backtick quotes ( «` ) on a new line at both the start and end of the block. To indicate code inline, wrap it with one backtick quote ( ` ).

Code highlighting entered within the Markdown widget renders code as plain preformatted text.

Example:

Result:

Example:

Result:

Within a Markdown file, text with four spaces at the beginning of the line automatically converts to a code block.

Set a language identifier for the code block to enable syntax highlighting for any of the supported languages in highlightjs, version v9.10.0.

More examples:

Tables

Supported in: Markdown widget | Pull Requests | README files | Wikis

Organize structured data with tables. Tables are especially useful for describing function parameters, object methods, and other data that have a clear name to description mapping. You can format tables in pull requests, wiki, and Markdown files such as README files and Markdown widgets.

Example:

Result:

Heading 1Heading 2Heading 3
Cell A1Cell A2Cell A3
Cell B1Cell B2Cell B3
second line of text

Lists

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Organize related items with lists. You can add ordered lists with numbers, or unordered lists with just bullets.

Ordered or numbered lists

Example:

Result:

Bulleted lists

Example:

Result:

Nested lists

Example:

Result:

Links

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

In pull request comments and wikis, HTTP and HTTPS URLs are automatically formatted as links. You can link to work items by entering the # key and a work item ID, and then choosing the work item from the list.

Avoid auto suggestions for work items by prefixing # with a backslash ( \ ). This action can be useful if you want to use # for color hex codes.

In Markdown files and widgets, you can set text hyperlinks for your URL using the standard Markdown link syntax:

When you’re linking to another Markdown page in the same Git or TFVC repository, the link target can be a relative path or an absolute path in the repository.

Supported links for Welcome pages:

Supported links for Markdown widget:

Supported links for Wiki:

Links to documents on file shares using file:// aren’t supported on 2017.1 and later versions. This restriction has been implemented for security purposes.

For information on how to specify relative links from a Welcome page or Markdown widget, see Source control relative links.

Example:

Result:

Source control relative links

Links to source control files are interpreted differently depending on whether you specify them in a Welcome page or a Markdown widget. The system interprets relative links as follows:

Welcome pageMarkdown widget equivalent
/BuildTemplates/AzureContinuousDeploy.11.xaml/DefaultCollection/Fabrikam Fiber/_versionControl#path=$/Tfvc Welcome/BuildTemplates/AzureContinuousDeploy.11.xaml
./page-2.md/DefaultCollection/Fabrikam Fiber/_versionControl#path=$/Tfvc Welcome/page-2.md

Anchor links

Within Markdown files, anchor IDs are assigned to all headings when rendered as HTML. The ID is the heading text, with the spaces replaced by dashes (-) and all lower case. In general, the following conventions apply:

Example:

Result:

The syntax for an anchor link to a section.

The ID is all lower case, and the link is case-sensitive, so be sure to use lower case, even though the heading itself uses upper case.

You can also reference headings within another Markdown file:

In wiki, you can also reference heading in another page:

Images

Supported in: Markdown widget | Pull Requests | README files | Wikis

To highlight issues or make things more interesting, you can add images and animated GIFs to the following aspects in your pull requests:

Use the following syntax to add an image:

Example:

Result:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

The path to the image file can be a relative path or the absolute path in Git or TFVC, just like the path to another Markdown file in a link.

Be sure to include a space before the equal sign.

Checklist or task list

Supported in: Pull Requests | Wikis

Lightweight task lists are great ways to track progress on your to-dos as a pull request creator or reviewer in the PR description or in a wiki page. Select the Markdown toolbar to get started or apply the format to selected text.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

After you’ve added a task list, you can check the boxes to mark items as completed. These actions are expressed and stored within the comment as [ ] and [x] in Markdown.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Result:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

A checklist within a table cell isn’t supported.

Emoji

Supported in: Pull Requests | Wikis

In pull request comments and wiki pages, you can use emojis to add character and react to comments in the request. Enter what you’re feeling surrounded by : characters to get a matching emoji in your text. The full set of emojis are supported.

Example:

Result:

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

To escape emojis, enclose them using the ` character.

Example:

Result:

Ignore or escape Markdown syntax to enter specific or literal characters

Supported in: Definition of Done | Markdown widget | Pull Requests | README files | Wikis

Syntax

Example/notes

Attachments

Supported in: Pull Requests | README files | Wikis

In pull request comments and wiki pages, you can attach files to illustrate your point or to give more detailed reasoning behind your suggestions. To attach a file, drag and drop it into the comment field or wiki page edit experience. You can also select the paperclip in the upper right of the comment box or the format pane in your wiki page.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

If you have an image in your clipboard, you can paste it from the clipboard into the comment box or wiki page and it renders directly into your comment or wiki page.

Attaching non-image files creates a link to the file in your comment. Update the description text between the brackets to change the text displayed in the link. Attached image files render directly into your comment or wiki pages. After you save or update a comment or wiki page with an attachment, you can see the attached image and select links to download attached files.

Attachments support the following file formats.

Not all file formats are supported within pull requests, such as Microsoft Office Message (.msg) files.

Mathematical notation and characters

Supported in: Pull Requests | Wikis

Both inline and block KaTeX notation is supported in wiki pages and pull requests. The following supported elements are included:

This feature is supported within Wiki pages and pull requests for TFS 2018.2 or later versions.

Markdown code block

Note: This document is itself written using Markdown; you can see the source for it by adding ‘.text’ to the URL.

Markdown is intended to be as easy-to-read and easy-to-write as is feasible.

To this end, Markdown’s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean. E.g., asterisks around a word actually look like *emphasis*. Markdown lists look like, well, lists. Even blockquotes look like quoted passages of text, assuming you’ve ever used email.

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style *emphasis* inside an HTML block.

Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.

Automatic Escaping for Special Characters

Ampersands in particular are bedeviling for web writers. If you want to write about ‘AT&T’, you need to write ‘ AT&T ‘. You even need to escape ampersands within URLs. Thus, if you want to link to:

you need to encode the URL as:

in your anchor tag href attribute. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well-marked-up web sites.

So, if you want to include a copyright symbol in your article, you can write:

and Markdown will leave it alone. But if you write:

Markdown will translate it to:

Similarly, because Markdown supports inline HTML, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such. But if you write:

Markdown will translate it to:

However, inside Markdown code spans and blocks, angle brackets and ampersands are always encoded automatically. This makes it easy to use Markdown to write about HTML code. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single and & in your example code needs to be escaped.)

Paragraphs and Line Breaks

The implication of the «one or more consecutive lines of text» rule is that Markdown supports «hard-wrapped» text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s «Convert Line Breaks» option) which translate every line break character in a paragraph into a
tag.

When you do want to insert a
break tag using Markdown, you end a line with two or more spaces, then type return.

Markdown supports two styles of headers, [Setext] 1 and [atx] 2.

Setext-style headers are «underlined» using equal signs (for first-level headers) and dashes (for second-level headers). For example:

Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:

Markdown uses email-style > characters for blockquoting. If you’re familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown. It looks best if you hard wrap the text and put a > before every line:

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of > :

Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:

Any decent text editor should make email-style quoting easy. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu.

Markdown supports ordered (numbered) and unordered (bulleted) lists.

is equivalent to:

Ordered lists use numbers followed by periods:

It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces. The HTML Markdown produces from the above list is:

If you instead wrote the list in Markdown like this:

you’d get the exact same HTML output. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab.

To make lists look nice, you can wrap items with hanging indents:

But if you want to be lazy, you don’t have to:

If list items are separated by blank lines, Markdown will wrap the items in

tags in the HTML output. For example, this input:

Markdown syntax guide

By default, Stash uses Markdown as its markup language. You can use markdown in the following places:

Use Control-Shift-P or Command-Shift-P to preview your markdown.

Markdown syntax

The page below contains examples of Markdown syntax. For a full list of all the Markdown syntax, consult the official documentation on John Gruber’s Daring Fireball site.

Headings

On this page:

Paragraphs

Character styles

Unordered list

Ordered list

List in list

Quotes or citations

Inline code characters

Code blocks

Links to external websites

Linking issue keys to JIRA

When you use JIRA issue keys (of the default format) in comments and pull request descriptions Stash automatically links them to the JIRA instance.

The default JIRA issue key format is two or more uppercase letters ( [A-Z][A-Z]+ ), followed by a hyphen and the issue number, for example STASH-123.

Images

Inline image syntax looks like this:

Reference image links look like this:

where ‘id’ is the name of a previously defined image reference, using syntax similar to link references:

Tables

You can also use HTML.

An example, to add a table:

Note that Markdown formatting syntax is not processed within block-level HTML tags. That is, you can’t use Markdown-style *emphasis* inside an HTML block.

Backslash escapes

Certain characters can be escaped with a preceding backslash to preserve the literal display of a character instead of its special Markdown meaning. This applies to the following characters:

\ backslash
` backtick
* asterisk
_ underscore
<> curly braces
[] square brackets
() parentheses
# hash mark
> greater than
+ plus sign
— minus sign (hyphen)
. dot
! exclamation mark

README files

luong-komorebi/Markdown-Tutorial

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Hello, welcome to my tutorial for markdown. 👋

In this tutorial you will learn the most basics things about Markdown. 👩‍🏫 👨‍🏫

Tables of contents

According to Wikipedia :

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. 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.

There is no clearly defined Markdown standard. This has led to fragmentation as different vendors write their own variants of the language to correct flaws or add missing features.. A list of markdown flavour is available here.

From now, this guide will mainly focus on Github Flavoured Markdown.

Why use markdown?

Tools for markdown

As said above, any editors can be used to edit markdown. However, there are a few tools that may be useful for you when it comes to edit markdown.

PreformattedBegin each line with,two spaces or more to,make text look,e x a c t l y,like,you,type i,t.Begin each line with,two spaces or more to,make text look,e x a c t l y,like,you,type i,t.
Code`Insert Code`cout
Code block/ Syntax highlighting«`insert code«`Hey,Please read the note below this table.
Headers#, ##, ###, ####, #####, ###### (from h1 to h6)

This is a h3 header

Insert text here

Note: **Footnote** actually doesnt render properly in table, but it kinda looks like this

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

The same goes for block code/syntax hightlighting. It kinda looks like this picture :

These characteristics are dependent upon each markdown flavour.

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax. One commonly used backslash escape character is : \
So? \*This\* isnt italic anymore but is surrounded by literal asterisks.

Youtube videos require some additional work.

Markdown does support Emojii 😆 😆 😘 😇 💚 ( get some emojies here )

You can use
tag to force line break.

Double space then enter if you want to make a new line if there is trouble making new lines.

Seeing is not as good as practicing. You can either create a markdown file for yourself to practice or do it online here.

Footnotes and syntax highlighting are not part of the original markdown and are only supported by certain flavors of markdown (Feedback from Sean Brody)

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

Markdown table support is designed to handle most tables for most people; it doesn’t cover all tables for all people. If you need complex tables you will need to create them by hand or with a tool specifically designed for your output format.

Using image and links, you can create some colorful assets at render time. Badges like this are typical examples that you can find all over Github Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block ( get some badges here )

Using code block syntax with diff language to generate colored text. There are still some limitations such as can not style the text inside and few colors. This can be applicable when you want to highlight some note or to show difference between two code block

In markdown file on Github, with code block syntax and Mermaid language specifed, we can draw many kinds of diagram. More syntax and sample diagrams here

Author: Vo Tran Thanh Luong. Also, I would like to thank all the contributors/translators for your work making this greater.

Markdown Here Cheatsheet

Clone this wiki locally

This is intended as a quick reference and showcase. For more complete info, see John Gruber’s original spec and the Github-flavored Markdown info page.

This cheatsheet is specifically Markdown Here’s version of Github-flavored Markdown. This differs slightly in styling and syntax from what Github uses, so what you see below might vary a little from what you get in a Markdown Here email, but it should be pretty close.

You can play around with Markdown on our live demo page.

(If you’re not a Markdown Here user, check out the Markdown Cheatsheet that is not specific to MDH. But, really, you should also use Markdown Here, because it’s awesome. http://markdown-here.com)

Table of Contents

Alternatively, for H1 and H2, an underline-ish style:

Emphasis, aka italics, with asterisks or underscores.

Strong emphasis, aka bold, with asterisks or underscores.

Combined emphasis with asterisks and underscores.

Strikethrough uses two tildes. Scratch this.

Actual numbers don’t matter, just that it’s a number

And another item.

Some text that should be aligned with the above item.

There are two ways to create links.

Or leave it empty and use the link text itself

URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or http://www.example.com and sometimes example.com (but not on Github, for example).

Some text to show that the reference links can follow later.

Here’s our logo (hover to see the title text):

Code and Syntax Highlighting

Inline code has back-ticks around it.

Again, to see what languages are available for highlighting, and how to write those language names, see the highlight.js demo page.

Colons can be used to align columns.

TablesAreCool
col 3 isright-aligned$1600
col 2 iscentered$12
zebra stripesare neat$1

The outer pipes (|) are optional, and you don’t need to make the raw Markdown line up prettily. You can also use inline Markdown.

MarkdownLessPretty
Stillrendersnicely
123

Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.

This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

You can also use raw HTML in your Markdown, and it’ll mostly work pretty well.

Markdown Syntax

In YouTrack, you can format text using the Markdown markup syntax. You can format text in issue descriptions, supplemental text fields, comments, and work items descriptions. This type of markup is offered as an alternative to the visual formatting tools in the rich text editor. To learn more about the available options for formatting text, see Rich Text Editor.

The Markdown implementation in YouTrack follows the CommonMark specification with extensions. These extensions support formatting options that are not included in the formal specification like checklists, strikethrough text, tables, user mentions, and issue links.

To see a complete list of formatting options, click the Markdown link to open the syntax list, then click the help icon. This opens the YouTrack Markup Reference page in your browser.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

The YouTrack Markup Reference page provides a sandbox. Use the sandbox to preview the formatted output. When the text is formatted to your liking, copy the contents of the sandbox and paste it into the issue description or comment.

Availability

In addition to issue fields, YouTrack supports Markdown in project descriptions, Markdown Notes widgets, user agreements, system-wide banners, and custom messages on the login page. Many of the extensions that are described here are not available in these fields. For example, the extensions that support embedded content from Google apps, embedded video, YouTube video, issue links, article links, and user mentions are only supported in issues and articles. The ability to parse HTML tags is exclusive to issues and articles as well.

To ensure that the content you enter in these fields is formatted correctly, use the preview pane to the left of the input field.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Character Formatting

You can apply character formatting to a range of inline text with the following Markdown syntax.

Surround text with two asterisks ( ** ) or two underscore characters ( __ ).

Surround text with single asterisks ( * ) or single underscore characters ( _ ).

Surround text with two tildes (

Surround text with one or more backquotes ( ` ) to format an inline code span.

Surround text with single underscore characters or two tildes inside two asterisks. Surround text with three asterisks to apply strong emphasis.

— it wasn’t _that_ important. Let’s try a few `combinations`: **This text is strong,

this text is strong with strikethrough

, and _this text is formatted with strong emphasis_** ***This text is formatted with strong emphasis too.***

Headings

To apply a heading style, start the line with one to six number signs( # ). Follow the number signs with a space character and enter the heading text. The number of # signs determines the heading level.

YouTrack also supports an alternative syntax for heading levels 1 and 2:

For heading level 1, enter one or more = characters on the following line.

Paragraphs and Line Breaks

Contiguous lines of text belong to the same paragraph. Use the following guidelines to structure your content into paragraphs and enter line breaks.

To start a new paragraph, leave a blank line between lines of text.

To start a new line inside a paragraph, enter two or more trailing spaces at the end of the line of text. For a more visible alternative, enter a single backslash ( \ ).

Thematic Breaks

Create sections in your content with thematic breaks. Use any of the following methods to add a thematic break:

Three or more underscores ( ___ )

Three or more asterisks ( *** )

Note that thematic breaks can interrupt paragraphs and can include whitespace characters. You cannot have more than three spaces of indent and you must use the same non-whitespace character.

Block Quotes

Use block quotes to call special attention to a quote from another source. You can apply character formatting to inline text inside the quoted block.

To set text as a quote block, start the line with one or more > characters. Follow these characters with a space and enter the quoted text. The number of > signs determines the level of nesting inside the quote block.

If your quote spans multiple paragraphs, each blank line must start with the > character. This ensures that the entire quote block is grouped together.

Indented Code Blocks

You can format blocks of text in a monospaced font to make it easier to identify and read as code.

To format a code block in Markdown, indent every line of the block by at least four spaces. An indented code block cannot interrupt a paragraph, so you must insert at least one blank line between a paragraph the indented code block that follows. The input is processed is as follows:

One level of indentation (four spaces) is removed from each line of the code block.

The contents of the code block are literal text and are not parsed as Markdown.

Any non-blank line with fewer than four leading spaces ends the code block and starts a new paragraph.

Fenced Code Blocks

Unlike indented code blocks, fenced code blocks have an info string that lets you specify which language is used for syntax highlighting. Language-specific highlights make the code easier to read.

Syntax highlighting is supported for a range of languages. YouTrack detects and highlights code in C, C++, C#, Java, JavaScript, Perl, Python, Ruby, and SH automatically. To highlight code in other languages, set the language in the info string (the line with the opening code fence). The following languages are supported: apollo (AGC/AEA Assembly Language), basic, clj (Clojure), css, dart, erlang, hs (Haskell), kt (Kotlin), latex (LaTeX), lisp, llvm, lua, matlab, ml, mumps, n (Nemerle), pascal, proto, scala, sql, tcl, tex, vb, vhdl, wiki, xq, and yaml.

When you set the language in the info string, the language tag is shown in the line above the code.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

YouTrack recognizes a set of language aliases that are interpreted by the Markdown implementation in GitHub. This includes the following language aliases:

Markdown Cheat Sheet

A quick reference to the Markdown syntax.

Overview

This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can’t cover every edge case, so if you need more information about any of these elements, refer to the reference guides for basic syntax and extended syntax.

Basic Syntax

These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements.

ElementMarkdown Syntax
Heading# H1
## H2
### H3
Bold**bold text**
Italic*italicized text*
Blockquote> blockquote
Ordered List1. First item
2. Second item
3. Third item
Unordered List— First item
— Second item
— Third item
Code`code`
Horizontal Rule
Link[title](https://www.example.com)
Image![alt text](image.jpg)

Extended Syntax

These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.

[^1]: This is the footnote.

Heading ID### My Great Heading
Definition Listterm
: definition
Strikethrough
Task List— [x] Write the press release
— [ ] Update the website
— [ ] Contact the media
Emoji
(see also Copying and Pasting Emoji)
That is so funny! :joy:
HighlightI need to highlight these ==very important words==.
SubscriptH

Downloads

You can download this cheat sheet as a Markdown file for use in your Markdown application.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Take your Markdown skills to the next level.

Learn Markdown in 60 pages. Designed for both novices and experts, The Markdown Guide book is a comprehensive reference that has everything you need to get started and master Markdown syntax.

Want to learn more Markdown?

Don’t stop now! 🚀 Star the GitHub repository and then enter your email address below to receive new Markdown tutorials via email. No spam!

code block inside table row in Markdown

I am putting together some documentation in Github flavoured Markdown and I want to put together a table that has two rows. One with simply text and one with a json code block. Heres an example.

I want to get this code inside the response row but when ever I try it completely breaks.

I am new to Markdown and if anyone could point me in the right direction it would be very much appreciated.

5 Answers 5

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

As others have pointed out, you’ll have to use HTML

tags to create the table. It is possible however to format the contents of the table cells using Markdown only

Markdown syntax within HTML blocks works if you leave extra blank lines around the HTML tags: one after the

otherwise the Markdown inside won’t be parsed! This creates a new

paragraph where Markdown parsing is re-enabled inside the table cells.

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

(If you want to fix the bad vertical alignment between «400» and «Markdown here», add blank lines around the «400» too, which will wrap that in a

carwin/markdown-styleguide

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Style Guidelines: Markdown

This document contains formatting standards for creating readable, consistent files using Markdown.

One problem I run into constantly when creating Markdown files is that I waste an ass-load of time fiddling with how the text looks before it gets parsed. Then, after I’m finished writing, I waste even more time adjusting what looks good in my text editor so that it looks good in a browser or Markdown viewer.

Being a masochist, I of course decided to create a guideline I could follow which would produce decent looking output without looking stupid in vim.

Basic conventions for Markdown files

Header text must use the atx-style with no closing # character.

Include a space between the # and the text of the Header^1.

Headers spanning more than 80 characters should be re-evaluated.

Headers must be preceded and followed by a newline except at the beginning of a file.

The convention for horizontal rules in this style guide is to use hyphens (instead of asterisks or underscores). Following another basic convention of the guide, horizontal rules should span 80 characters for readability.

List items must be indented 4 spaces further than their parent.

The first level of list items must not be preceded by a newline.

All lists must be followed by newlines.

List item lines exceeding 80 characters should, when wrapped, align vertically with the beginning of the preceding line’s text.

Inline code must use single backticks and must not have spaces between the backtick characters and the code.

Fenced code blocks must be preceded and followed by a newline.

When used inside list items, fenced code blocks must be indented as if they were one level deeper that the list item that contains them.

Like fenced code blocks, tables in Markdown are provided by Markdown Extra which seems to be pretty widely implemented.

Pipe characters must be preceded and followed by spaces for readability.

Table column width should be determined by the longest cell in the column.

Always format tables so they are readable in pre-processing.

Never use preceding or trailing pipes when writing tables.

Tables must always be preceded and followed by newlines.

This table meets all the criteria:

A handsome table in pre-processed markdown is also handsome when rendered:

and one before the
GroupDomainFirst Appearance
ShinRaMako ReactorsFFVII
MooglesMogNetFFIII
Vana’diel Chocobo SocietyChocobo RaisingFFXI:TOAU

About

Formatting standards for readable & consistent Markdown

Markdown

The Gitiles source browser automatically renders *.md Markdown files into HTML for simplified documentation.

Contents

Access controls

Access controls for documentation is identical to source code.

Documentation stored with source files shares the same permissions. Documentation stored in a separate Git repository can use different access controls. If Gerrit Code Review is being used, branch level read permissions can be used to grant or restrict access to any documentation branches.

READMEs

Files named README.md are automatically displayed below the file’s directory listing. For the top level directory this mirrors the standard GitHub presentation.

We recommend that Git repositories have an up-to-date top-level README.md file.

Markdown syntax

Gitiles supports the core Markdown syntax described in Markdown Basics. Additional extensions are supported to more closely match GitHub Flavored Markdown and simplify documentation writing.

Paragraphs

Paragraphs are one or more lines of consecutive text, followed by one or more blank lines. Line breaks within a paragraph are ignored by the parser, allowing authors to line-wrap text at any comfortable column width.

Headings

Headings can be indicated by starting the line with one or more # marks. The number of # used determines the depth of the heading in the document outline. Headings 1 through 6 ( ###### ) are supported.

Lists

will render into HTML as:

The second level items (above Orange, Pear) must be indented with more spaces than the item they are nested under. Above 2 spaces were used. Additionally, the entire list must be preceded and followed by a blank line.

A numbered list:

will render into HTML as:

Like bullet lists, numbered lists can be nested by using more leading space than the prior list item.

Tables

Simple tables are supported with column alignment. The first line is the header row and subsequent lines are data rows:

FoodCaloriesTasty?
Apple95Yes
Pear102Yes
Hay977
[Food and its benefits]

Placing : in the separator line indicates how the column should be aligned. A colon on the left side is a left-aligned column; a colon on the right-most side is right-aligned; a colon on both sides is center-aligned.

An optional table title can be placed under the table in brackets ( [. ] ).

Cells may span multiple columns and include formatting accepted within paragraphs such as emphasis, images or links:

the above table was created by:

Empty table cells are indicated by whitespace between the column dividers ( | | ) while multiple column cells omit the whitespace.

Emphasis

Emphasize paragraph text with italic and bold styles. Either _ or * can be used for italic (1 character) and bold text (2 characters). This allows styles to be mixed within a statement:

It is strongly encouraged to review documentation for typos.

Strikethrough

Text can be struck out within a paragraph:

Note two tildes are required (

) on either side of the struck out section of text.

Smart quotes

‘Single’, “double” and <> quotes in paragraph text are replaced with smart quotes. Apostrophes (this doc’s text), ellipses (“. ”) and dashes (“—” and “—”) are also replaced with HTML entities to make the documentation appear typeset.

Blockquotes

Blockquoted text can be used to stand off text obtained from another source:

Sir Winston Churchill once said:

A lie gets halfway around the world before the truth has a chance to get its pants on.

Code (inline)

Use backticks to markup inline code within a paragraph:

Code (blocks)

Create a fenced code block using three backticks before and after a block of code, preceeded and followed by blank lines:

Visit this site for more examples.

Search for markdown style examples.

Visit Google to search the web.

Running

Format

Coding

Format

Libraries

Examples

Examples

Markdown code block. Смотреть фото Markdown code block. Смотреть картинку Markdown code block. Картинка про Markdown code block. Фото Markdown code block

Title

Contents

Section 1

Section 2

Columns

Prettify

the page layout.

Can be

Right

The parser allows whitespace including newlines between attributes, but strictly limits the supported attribute set to:

src : An https:// or http:// URL of the page to embed inside of an iframe at this position in the document. Malformed URLs will cause the iframe to be silently dropped. (required)

height : CSS pixel height such as 250px defining the amount of vertical space to give to the embedded content. Only px units are supported; a malformed dimension will drop the iframe. (required)

width : CSS pixel width such as 250px or a precentage such as 80% defining the amount of horizontal space to give to the embedded content. Only px units or % are supported; a malformed dimension will drop the iframe. (required)

frameborder : By default a border is drawn around the iframe by the browser. The border can be hidden by adding frameborder=»0″ to the iframe tag. (optional)

Embedded source URLs must also be whitelisted by the Gitiles markdown.allowiframe configuration variable.

Site layout

Gitiles includes additional support to create functional documentation sites served directly from Git repositories.

Navigation bar

A top level navigation bar is automatically included on all pages if there is a navbar.md file present in the top of the repository. This file should be a simple bulleted list of links to include in the navigation bar.

Site title

A site wide banner is displayed on all Markdown pages if navbar.md includes a H1 header. The text of the header is display on the left side of the banner.

Site logo

See images above for acceptable URLs and how repository relative paths are handled by inline data URIs.

Home link

Page title

Titles for pages are extracted from the first H1 heading appearing in the document. This is traditionally placed on the first line of the markdown file, e.g.:

The title is included in the HTML element and also in the right side of the banner if navbar.md defines a site title.

Configuration

The gitiles.config file supporting the site contains several configuration options that impact markdown rendering.

Disabling markdown

Markdown can be completely disabled by setting render to false.

Markdown size

Markdown files are limited by default to 5 MiB of input text per file. This limit is configurable, but should not be raised beyond available memory.

Image size

Referenced images are inlined as base64 encoded URIs. The image limit places an upper bound on the byte size of input.

Google Analytics

Google Analytics can be enabled on every rendered markdown page by adding the Property ID to the configuration file:

Источники:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *