# Markdown Syntax

When adding comments or suggesting questions, you can take advantage of Markdown syntax to add links, emphasis, and headers. Additionally, you can add mathematical equations via MathJax, which will convert LaTeX syntax into nicely typeset equations. We closely follow the official Markdown syntax, so that's the best place to look for a thorough explanation of how the system works. We provide a brief overview of the most common uses here.

## Inline elements

Links can be produced using a [link title](http://and-link-address.com) or by surrounding a link with < and >, like <http://www.example.com>. There are a number of shortcuts to make your life easier if you keep repeating the same link (see the docs), but these will cover 90% of the use cases.

Asterisks (*) and underscores (_) will both _italicize_ text, and two asterisks will make the text **bold**. Back-ticks denote fixed-width text. If you want small text, you can wrap it in a literal <small>html tag</small\>. Special characters (*_{}#+-.!\) can be escaped using a backslash, like \*, if they would otherwise be converted into a markdown element.

## Math

We supplement Markdown with MathJax equation processing. Mathematical formatting works by placing your equation between $$ and $$ (for inline equations) or $ and $ (for displayed equations). More complicated equations can be put in an align environment, like so

\begin{align}
\nabla \times \vec{\mathbf{B}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}


producing

# Primary header


## Code

Big chunks of code can be indented by four spaces to make the text fixed-width and preserve whitespace, or it can be wrapped in three back-ticks. For example:

    def hello_world():
print('hello!')


and


def hello_world():
print('hello!')



have the same output.

## Quotes

If you want to quote someone, precede each line with a >:

> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.


which would produce:

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.

## Lists

Markdown can handle both ordered and unordered lists. For example,

1. First item
2. Second item

Another paragraph in the second item.

- Sublist item 1. Note that it's indented 4 spaces.
- Sublist item 2.

3. Third item.


produces:

1. First item
2. Second item

Another paragraph in the second item.

• Sublist item 1. Note that it's indented 4 spaces.
• Sublist item 2.
3. Third item.

Unordered lists behave similarly, but use asterisks or pluses or hyphens to denote new items.

## Tables

We support simple tables of the form:


| Cell 1   | Cell 2   |   ← line 1
| Cell 3   | Cell 4   |   ← line 2



Columns are separated by the pipe character |, and each line is a row. For example this:


|Year | Predictions |  Total |
|-----|-------------|--------|
|2015 |         500 |    500 |
|2016 |       25500 |  26000 |
|2017 |       21000 |  47000 |
|2018 |       63000 | 110000 |
|2019 |       50000 | 160000 |
|2020 |      220000 | 380000 |



Will render as :

Year Predictions Total
2015 500 500
2016 25500 26000
2017 21000 47000
2018 63000 110000
2019 50000 160000
2020 220000 380000

But note that:

• White spaces before and after the pipes are ignored.
• The initial and final pipes of each line are optional (except for one-column tables, see below).
• The dashes in the separator line are optional.

Which means that the following markdown renders the same as above:


Year|Predictions|Total
||
2015|500|500
2016|25500|26000
2017|21000|47000
2018|63000|110000
2019|50000|160000
2020|220000|380000



Also note that all table lines must include at least one pipe, so the initial (or final) pipe is mandatory for one-column tables:


|U_n
|-
|1
|11
|21
|1211
|111221



## Fine print

Question texts support collapsible fine print sections with the syntax:

Text before the fine print.
[fine-print]
Text in the fine print.
[/fine-print]


Which would give:

Text in the fine print.

## Differences and limitations

The official Markdown specification lets users input raw html, but we limit users to the elements described above. For example, if you try to input an image using ![Alt text](/path/to/img.jpg) the output will look like <img alt="Alt text" src="/path/to/img.jpg"/>, and something like <script>doSomethingEvil()</script>` certainly won't work. We also employ a few markdown extensions that handle fenced code blocks (described above) and make lists and bolded text a little easier to manage.