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.
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.
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.
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:
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.
Colons can be used to align columns.
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are 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.
Markdown | Less | Pretty |
---|---|---|
Still | renders | nicely |
1 | 2 | 3 |
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:
Syntax | Description |
---|---|
Header | Title |
Paragraph | Text |
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:
Syntax | Description | Test Text |
---|---|---|
Header | Title | Here’s this |
Paragraph | Text | And 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.
Markdown | HTML | Rendered Output |
---|---|---|
[Heading IDs](#heading-ids) | Heading IDs | Heading 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:
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:
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.
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.
Style | Syntax | Keyboard shortcut | Example | Output |
---|---|---|---|---|
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 |
Strikethrough | This 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 | |
Subscript | This is a subscript text | This is a subscript text | ||
Superscript | This is a superscript text | This is a superscript text |
, 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.
To format code or text into its own distinct block, use triple backticks.
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.
Here are the currently supported color models.
Color | Syntax | Example | Output |
---|---|---|---|
HEX | `#RRGGBB` | `#0969DA` | |
RGB | `rgb(R,G,B)` | `rgb(9, 105, 218)` | |
HSL | `hsl(H,S,L)` | `hsl(212, 92%, 45%)` |
Notes:
This site was built using [GitHub Pages](https://pages.github.com/).
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:
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:

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.
To order your list, precede each line with a number.
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.
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.
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?
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.»
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:
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\*.
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.
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 ).
Markdown | HTML | Rendered Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
# Heading level 1 |
Markdown | HTML | Rendered 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.
Markdown | HTML | Rendered 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.
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.
Markdown | HTML | Rendered 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. EmphasisYou 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.
Bold Best PracticesMarkdown 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.
ItalicTo 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.
Italic Best PracticesMarkdown 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.
Bold and ItalicTo 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.
Bold and Italic Best PracticesMarkdown 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.
BlockquotesTo create a blockquote, add a > in front of a paragraph. The rendered output looks like this:
Blockquotes with Multiple ParagraphsBlockquotes can contain multiple paragraphs. Add a > on the blank lines between the paragraphs. The rendered output looks like this:
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood. Nested BlockquotesBlockquotes can be nested. Add a >> in front of the paragraph you want to nest. The rendered output looks like this:
Blockquotes with Other ElementsBlockquotes 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 PracticesFor compatibility, put blank lines before and after blockquotes.
ListsYou can organize items into ordered and unordered lists. Ordered ListsTo 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 PracticesCommonMark 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.
Unordered ListsStarting Unordered List Items With NumbersIf 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 PracticesMarkdown 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.
Adding Elements in ListsTo 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. ParagraphsThe rendered output looks like this: Here’s the second list item. I need to add another paragraph below the second list item. BlockquotesThe rendered output looks like this: Here’s the second list item.
Code BlocksCode 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: ImagesThe rendered output looks like this: Marvel at its beauty. ListsYou 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 BackticksIf 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 ( « ).
Code BlocksTo create code blocks, indent every line of the block by at least four spaces or one tab. The rendered output looks like this: Horizontal RulesThe rendered output of all three looks identical: Horizontal Rule Best PracticesFor compatibility, put blank lines before and after horizontal rules.
LinksTo 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 TitlesYou 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 AddressesTo quickly turn a URL or email address into a link, enclose it in angle brackets. The rendered output looks like this: Formatting LinksTo 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 LinksReference-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 LinkThe 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 LinkThe 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 TogetherSay 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:
and the HTML for the link would be: Link Best Practices
ImagesThe rendered output looks like this: Linking ImagesTo 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: Escaping CharactersTo 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 EscapeYou can use a backslash to escape the following characters.
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 PracticesFor 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** 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 blockNote: 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 When you do want to insert a 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 blockCopy 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:7465176Note: 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 When you do want to insert a 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 blockCopy 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 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.
Blockquotes can also be nested:
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).
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.
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.
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:2019322Note: 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 When you do want to insert a 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 SyntaxAdvanced features based on the foundations of Markdown.IntroductionThe 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.
Flavors of Markdownphoto 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 MarkdownA 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:
The width of the cells, within a Markdown table, can vary. Generating tables in Markdown automaticallyMarkdown 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. AlignmentMarkdown allows you to align the contents of a table column to the left, right or center.
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.
It is possible to merge the alignment formatting, since it only influences the content inside the column.
Formatting text in tablesYou can insert some basic elements of Markdown inside a table. Titles, code blocks, blockquotes, lists, horizontal rules, images and HTML tags do not work.
Escaping vertical bars in tablesphoto Escaping a vertical bar inside the table in Markdown Fenced code blockA 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:
instead of backticks to form the fenced code block. Syntax highlightingMany 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:
As in the first line of the block, just after the three opening backticks, json was specified, the code will be highlighted accordingly:
FootnotesA 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. ↩
Adding ID or Class to Markdown elementsWith 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
If the id is in another document, the formatting is similar, however, before identification, place the page URL. Definition ListsThe 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 MarkdownThe 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 MarkdownThe rendered output looks like this: photo Task List in Markdown Inserting Emojis in the Markdown documentYes, 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
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.
Using Emoji access codesAn 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 codeIf 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.
Automatic linking URLs in MarkdownSome 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 linkingThe rendered output looks like this:
Markdown code blockMarkdown 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 When you do want to insert a 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 If you end a line with three or more spaces then a 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-everyoneUse Git or checkout with SVN using the web URL. Work fast with our official CLI. Learn more. Launching GitHub DesktopIf nothing happens, download GitHub Desktop and try again. Launching GitHub DesktopIf nothing happens, download GitHub Desktop and try again. Launching XcodeIf nothing happens, download Xcode and try again. Launching Visual Studio CodeYour codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commitGit statsFilesFailed to load latest commit information. readme.mdMarkdown 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 SyntaxMark 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. OverviewPhilosophyMarkdown 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, 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 HTMLMarkdown’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 CharactersAmpersands 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 ElementsParagraphs and Line BreaksA 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 When you do want to insert a Yes, this takes a tad more effort to create a HeadersMarkdown 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.) : BlockquotesMarkdown 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. ListsMarkdown supports ordered (numbered) and unordered (bulleted) lists. Unordered lists use asterisks, pluses, and hyphens – interchangably 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 tags in the HTML output. For example, this input: Markdown code blockNote: 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 When you do want to insert a 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 blockNote: 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 When you do want to insert a 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. OverviewMarkdown 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 ElementsHeadingsHash # is used to create headings. The number of hashes denotes the heading level for e.g. ### denotes the third level heading. Heading 1Heading 1Heading 1Heading 2Heading 3Heading 3Heading 4Heading 4Heading 5Heading 5Heading 6Heading 6✅ Always add space between # and the heading for e.g. # Heading 1 works but #Heading 1 doesn’t. Alternate syntax for h1 and h2Heading 1Heading 1Heading 1Heading 1Heading 1Heading 2Heading 1Heading 2ParagraphsSingle ParagraphA simple line of text in Markdown creates a paragraph. This is a paragraph This is a paragraph Multiple ParagraphsA 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 breakTo add a line break in a paragraph, end a line with two or more spaces. I love Markdown. 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. 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 ListNested 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. Unordered ListNested Unordered ListNested list items can be created by adding indentation to the line. Each indentation creates deeper nested level. Escape period in ordered and unordered listEscape dash, asterisk and plus in ordered and unordered listDefinition ListsSome 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.
❌ Definition lists are NOT supported by all Markdown processors. BlockquotesBlockquotes with single paragraphBlockquotes is created by adding greater sign > in front of a text. Blockquotes with multiple paragraphsBlockquotes can contain multiple paragraphs. Add a greater sign > on the blank lines as well between the paragraphs.
I am second paragraph. Nested BlockquotesBlockquotes 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 BlockquotesBlockquotes 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 headersome example code : ✅ Blockquotes are supported by all Markdown processors. Code BlocksCode 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
Note: » › » denotes the space in above example. Fenced Code BlocksIf 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.
Syntax HighlightingMany 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. Horizontal Rulesproduce a horizontal rule like below:- ✅ Horizontal rules are supported by all Markdown processors. Tables
You can optionally add pipes on either end of the table.
Table Column Text AlignmentYou 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.
Table Cell Text FormattingYou 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.
Escape Pipe in TablesIf you want to use | character as a text in the table then you can escape it with blackslash i.e. \|
❌ Tables are NOT supported by all Markdown processors. Task ListsTask 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.
❌ Task lists are NOT supported by all Markdown processors. Span ElementsEmphasisAdd two asterisks ** or two underscores __ before and after a word for e.g. **bold** or __bold__ to render as bold.
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.
ItalicAdd an asterisk * or underscore _ before and after a word for e.g. *italic* or _italic_ to render as italic.
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.
✅ Italic is supported by all Markdown processors. Strikethroughbefore and after a word for e.g. | I am strike | I am strike | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I am strike and through | I am strike and through | I am strike and through | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I am strike | I am strike through | I 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.
Markdown | HTML | Output |
---|---|---|
I am ***bold and italic*** | I am bold and italic | I am bold and italic |
I am ___bold and italic___ | I am bold and italic | I am bold and italic |
I am __*bold and italic*__ | I am bold and italic | I am bold and italic |
I am **_bold and italic_** | I am bold and italic | I 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.
Markdown | HTML | Output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
**Escape \* in Bold** | Escape * in Bold | Escape * in Bold | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_Escape \_ in Italic_ | Escape _ in Italic | Escape _ in Italic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
EscapeInline Link
Inline Link with TitleInline Link can also be created with optional title which is displayed when hover on the link. Inline Link with URL and Email AddressURL 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 <>
Reference LinksReference-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. ImageInline ImageInline Image with TitleInline Image with LinkClickable image can also be created with link URL for e.g. [](URL) Reference ImageReference-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.
Escape backticks in code
Escaping CharactersSometime 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:-
SummaryCongratulations! 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 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.
And the generated HTML from a markdown parser might look something like this: Blockquotes can also be nested:
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. Like links, Images also have a footnote style syntax 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).
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.
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 docsThere 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 elementsA «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 styleTo 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.
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 styleSome 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. LinksA 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. PlaceholdersIf 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 blocksThe 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: ScreenshotsAll 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 validationIf 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. HighlightingSnippets 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: 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 barsBreak 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 codeIn 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 blocksUse 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 referencesThe 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 fileThe 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 numbersThis 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 snippetUse 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 linesThe 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 referencesIf 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 notebookYou can reference a cell in a Jupyter notebook as a code snippet. In order to reference the cell: Add metadata to notebookName 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 accessIf 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 referenceOnce 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 snippetsInline interactive code blocksFor 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 referenceYou 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 referenceThis syntax is a block Markdown extension. It must be used on its own line. Supported languagesThe Docs Authoring Pack includes a feature to provide statement completion and validation of the available language identifiers for code fence blocks. Fenced code blocksThe Docs Authoring Pack, Dev Lang Completion feature uses the first valid alias when multiple aliases are available. Next stepsFor information on text formatting for content types other than code, see Text formatting guidelines. Bitbucket SupportKnowledge baseProductsJira SoftwareProject and issue tracking Jira Service ManagementService management and customer support Jira CoreManage any business project ConfluenceBitbucketGit code management ResourcesDocumentationUsage and admin help CommunityAnswers, support, and inspiration Suggestions and bugsFeature suggestions and bug reports MarketplaceBilling and licensingFrequently asked questions ViewportConfluenceVersionsMarkdown syntax guideUse Bitbucket Data Center and ServerOn this pageRelated contentStill 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 syntaxThe 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:HeadingsParagraphsParagraphs are separated by empty lines. To create a new paragraph, press twice. Character stylesUnordered listOrdered listList in listQuotes or citationsInline code charactersCode blocksBitbucket 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 websitesLinking issue keys to JIRA applicationsWhen 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 requestsIntroduced 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. ImagesInline 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: TablesBackslash escapesCertain 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 Markdown Basic SyntaxIn this article you will learn about the elements that form the basis of the Markdown language.OverviewDespite 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.
TitlesEvery 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
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 syntaxphoto Alternative syntax for creating level 1 and level 2 headings photo Alternative syntax for headings using only one sign Titles: best practicesYou 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 ParagraphsThe 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 practicesUsually the paragraph is stuck at the beginning of the line, that is, avoid indenting it using spaces of any kind, neither blanks nor tabs.
Table 1.5 exemplifies the correct use of Markdown formatting for constructing a paragraph.
|