Basic Markdown Syntax Guide
Headers
Start a line with a hash character # to set a heading. Organize your remarks with subheadings by starting a line with more hash characters, for example ####. Up to six levels of headings are supported.
Example:
# This is a H1 header
## This is a H2 header
### This is a H3 header
#### This is a H4 header
##### This is a H5 header
###### This is a H6 header
BlockQuotes
Quote previous comments or text to set the context for your comment or text.
Quote single lines of text with > before the text. Use many > characters to nest quoted text. Quote blocks of lines of text by using the same level of > across many lines.
Example:
> Single line quote
> > Nested quote
> > multiple line
> > quote
Result:
Single line quote
Nested quote multiple line quote
Horizontal rules
To add a horizontal rule, add a line that's a series of dashes ---. The line above the line containing the --- must be blank.
Example:
above
---
below
Result:
above
below
Emphasis (bold, italics, strikethrough)
You can emphasize text by applying bold, italics, or strikethrough to characters:
To apply italics: surround the text with an asterisk * or underscore _ To apply bold: surround the text with double asterisks **. To apply strikethrough: surround the text with double tilde characters ~~. Combine these elements to apply emphasis to text.
Example:
Use emphasis in comments to express **strong** opinions and point out ~~corrections~~
**Bold, italicized text**
**~~Bold, strike-through text~~**
Result:
Use emphasis in comments to express strong opinions and point out corrections
Bold, italicized text
Bold, strike-through text
Code highlighting
Highlight suggested code segments using code highlight blocks. To indicate a span of code, wrap it with three backtick quotes (``) on a new line at both the start and end of the block. To indicate code inline, wrap it with one backtick quote (
).
Example:
``` CodeLanguage Code goes here ```
Result:
<html>
<head>
</title>
</head>
<body>
Code goes here
</body>
</html>
Tables
Organize structured data with tables. Tables are especially useful for describing function parameters, object methods, and other data that have a clear name to description mapping. You can format tables in pull requests, wiki, and Markdown files such as README files and Markdown widgets.
• Place each table row on its own line • Separate table cells using the pipe character | • The first two lines of a table set the column headers and the alignment of elements in the table • Use colons (:) when dividing the header and body of tables to specify column alignment (left, center, right) • To start a new line, use the HTML break tag (< br/>) (Works within a Wiki but not elsewhere) • Make sure to end each row with a CR or LF. • A blank space is required before and after work item or pull request (PR) mentions inside a table cell.
Example:
| Heading 1 | Heading 2 | Heading 3 |
| --------- | :-------: | --------: |
| Cell A1 | Cell A2 | Cell A3 |
| Cell B1 | Cell B2 | Cell B3 |
Result:
Heading 1 | Heading 2 | Heading 3 |
---|---|---|
Cell A1 | Cell A2 | Cell A3 |
Cell B1 | Cell B2 | Cell B3 |
Lists
Organize related items with lists. You can add ordered lists with numbers, or unordered lists with just bullets.
Ordered lists start with a number followed by a period for each list item. Unordered lists start with a -. Begin each list item on a new line. In a Markdown file or widget, enter two spaces before the line break to begin a new paragraph, or enter two line breaks consecutively to begin a new paragraph.
Ordered or numbered lists
Example:
1. First item.
2. Second item.
3. Third item.
Result:
- First item.
- Second item.
- Third item.
Bullet lists
Example:
- Item 1
- Item 2
- Item 3
Result:
- Item 1
- Item 2
- Item 3
Nested lists
Example:
1. First item.
- Item 1
- Item 2
- Item 3
2. Second item.
- Nested item 1
- Nested item 2
- Nested item 3
Result:
- First item.
- Item 1
- Item 2
- Item 3
- Second item.
- Nested item 1
- Nested item 2
- Nested item 3
Links
In pull request comments and wikis, HTTP and HTTPS URLs are automatically formatted as links. You can link to work items by entering the # key and a work item ID, and then choosing the work item from the list.
Avoid auto suggestions for work items by prefixing # with a backslash (). This action can be useful if you want to use # for color hex codes.
In Markdown files and widgets, you can set text hyperlinks for your URL using the standard Markdown link syntax:
Example:
[Samarth Docs](https://docs.samarth.ac.in)
Result:
Anchor links
Within Markdown files, anchor IDs are assigned to all headings when rendered as HTML. The ID is the heading text, with the spaces replaced by dashes (-) and all lower case. In general, the following conventions apply:
Punctuation marks and leading white spaces within a file name are ignored Upper case letters are converted to lower Spaces between letters are converted to dashes (-).
Example:
### Link to a heading in the page
[Link to a heading](#link-to-a-heading-in-the-page)
Result:
Link to a heading in the page
The ID is all lower case, and the link is case-sensitive, so be sure to use lower case, even though the heading itself uses upper case. You can also reference headings within another Markdown file:
[text to display](./target.md#heading-id)
In wiki, you can also reference heading in another page:
[text to display](/page-name#section-name)
Images
To highlight issues or make things more interesting, you can add images and animated GIFs to the following aspects in your pull requests:
Comments Markdown files Wiki pages Use the following syntax to add an image:
Example:
![Text](URL)
Example: ![Illustration to use for new users](https://samarth.edu.in/wp-content/uploads/2020/01/Analysing-Data-Opportunities.png)
The text in the brackets describes the image being linked and the URL points to the image location.
Result:
The path to the image file can be a relative path or the absolute path in Git or TFVC, just like the path to another Markdown file in a link.
• Relative path: ![Image alt text](./image.png)
• Absolute path in Git: ![Image alt text](/media/markdown-guidance/image.png)
• Absolute path in TFVC: ![Image alt text]($/project/folder/media/markdown-guidance/image.png)
• Resize image: IMAGE_URL = WIDTH x HEIGHT
Note: Be sure to include a space before the equal sign.
Example: ![Image alt text]($/project/folder/media/markdown-guidance/image.png =500x250)
It's also possible to specify only the WIDTH by leaving out the HEIGHT value: IMAGE_URL =WIDTHx
Checklist or task list
Lightweight task lists are great ways to track progress on your to-dos as a pull request creator or reviewer in the PR description or in a wiki page. Select the Markdown toolbar to get started or apply the format to selected text.
You can Use [ ] or [x] to support checklists. Precede the checklist with either -\<space> or 1.\<space> (any numeral).
Example - Apply the task list Markdown to a highlighted list
Example:
Example - Format a list as a task list
- [ ] A
- [ ] B
- [ ] C
- [x] A
- [x] B
- [x] C
Note: A checklist within a table isn't supported.
Result:
- A
- B
- C
- A
- B
- C
Emoji
In pull request comments and wiki pages, you can use emojis to add character and react to comments in the request. Enter what you're feeling surrounded by : characters to get a matching emoji in your text. The full set of emojis are supported.
Example:
:smile:
:angry:
Result:
😄 😠
To escape emojis, enclose them using the ` character.
Example:
`:smile:` `:)` `:angry:`
Result:
:smile:
:)
:angry:
Ignore or escape Markdown syntax to enter specific or literal characters
Example:
Some examples on inserting special characters:
Enter \\ to get \
Enter \_ to get \_
Enter \# to get #
Enter \( to get (
Enter \. to get .
Enter \! to get !
Enter \* to get \*