Jump to >

Using Markdown

New in version 2.0.

Many of the multi-line text fields in Review Board support a simple markup language called Markdown. This allows you to perform basic formatting of your text (such as creating lists or denoting emphasis), as well as more complex things like including syntax-highlighted code samples or images.

This document does not intend to be a full reference on the Markdown language, but rather a quick primer on the basic features that are useful when writing review requests or reviews.

Note

Review Board’s implementation of Markdown shares a lot in common with GitHub Flavored Markdown. While it’s part of the basic Markdown spec, embedding raw HTML is not allowed, to prevent cross-site scripting attacks. If you include HTML tags, they will be shown to the user as-is, rather than treated as HTML.

Basic Markdown Syntax

Headers

Headers are added by underlining the relevant text with equals signs or dashes:

Header
======

Lists

Markdown supports both ordered (numbered) and unordered (bulleted) lists. These are written using a natural syntax. Ordered lists use numbers followed by periods:

1. First item
2. Second item
3. Third item

While unordered lists can be defined with asterisks, plus signs, or hyphens:

* First item
* Second item
* Third item

Emphasis

Text can be emphasized by surrounding it with asterisks or underscores. The resulting text will be shown in a heavier font:

This text is *italic*

This text is **emphasized**

Images

If you have images which are accessible from a URL, you can embed them into your text using a syntax similar to links. These start with an exclamation mark, followed by square brackets containing the “alt” attribute, followed by parentheses with the URL to the image:

![Image description](http://example.com/image.png)

Tables

Simple tables can be inserted by drawing the table using a combination of vertical bars and hyphens:

Header | Header | Header
-------|--------|-------
Cell   | Cell   | Cell
Cell   | Cell   | Cell

Code Samples

When writing reviews, It’s often very useful to write small snippets of code. Markdown allows you to notate which parts of your text are code or terminal text, and optionally render code with syntax highlighting. This can be especially nice for proposing changes.

Code can be formatted inside a line by enclosing the text in single backticks. This is often useful when referring to symbols from the code:

I think it would be nice if you moved this code up near the `do_foo` method.

Longer code samples can be denoted using block notation. Any blocks which are indented at least 4 spaces will be treated as a code block. This code will not be syntax-highlighted, but instead will be shown as plain text.

The following code block will not be syntax-highlighted.

    def test():
        logging.error('Test failed')

In addition, code blocks can be notated without indentation by surrounding the block with triple backticks using the syntax from GitHub Flavored Markdown.

The following code block will not be syntax-highlighted.

```
function test() {
    console.log('Test failed');
}
```

You can specify a language name after the first set of backticks in order to enable syntax highlighting for the code. For instance:

The following code block WILL be syntax-highlighted.

```javascript
function test() {
    console.log('Test passed!');
}
```

Some of the most common language codes you may want to use include:

  • C: c
  • C++: cpp, c++
  • C#: csharp
  • CSS: css
  • CoffeeScript: coffeescript
  • HTML: html
  • JSON: json
  • Java: java
  • JavaScript: javascript, js
  • Objective-C: objective-c, obj-c, objc
  • Objective-C++: objective-c++, obj-c++, objc++
  • PHP: php
  • Perl: perl, pl
  • Python 3: python3, py3
  • Python: python, py
  • Ruby: ruby, rb
  • Snobol: snobol
  • XML: xml

For the complete list, look through the Pygments list of lexers. Any of the “short names” listed can be used.

Escaping

Because Markdown syntax endows many common punctuation symbols with special meaning, these can sometimes unintentionally trigger formatting. In this case, you can avoid this by escaping the relevant character with a backslash:

I really want a \` backtick in this line.

Backslash escapes can be used for the following characters:

\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign
. period
! exclamation mark