Markdown

It is possible to use Markdown within Swarm to add text styles to comments and documents. It is not supported in reviews.

Markdown in comments

Example comment with markdown

The supported set of Markdown styles in review comments is limited to inline styles, so headers and other structural syntax are ignored.

  • bold and italics can be specified with **bold** or *italics*.

  • Unordered lists can be specified with asterisk (*) markers. Plus (+) and minus (-) signs also work:

    * This
    * That
    * Another
    

  • Ordered lists can be specified with numbered markers:

    1. First
    2. Second
    3. Third
    

  • Hypertext links can be specified with [Link text](http://address/page). If you don't need to add anchor text, then a URL in the text without any markup is linkified.

  • You can mark inline text as code using `backticks`.

  • You can also mark blocks of code using three backticks on a line, like:

    ```
    var text = "Some code text";
    alert(text);
    ```
    

Markdown is only supported in comments, not in the review description.

The following example shows all of the above syntax in a single example, with both the source and the final result.

*Comments* can include **Markdown** text, which allows basic styles to be applied to the text.

You can have unordered lists, like this:
* A line
* Another line
  * A sub list
  * Again
* Back again

Or ordered lists:
1. First
2. Second
3. Third

It is possible to mark text as `code { like: this }` or to define a block of text as code:
```
var i = 1;
var j = 10;
for (i = 1; j != i; i++) {
  print i * j;
}
```

You can also [create hyper links](http://www.perforce.com) which point to other places.

Example of all supported markdown

Markdown in projects

Project pages can have a README.md file in the root of their MAIN branch, which if present will be displayed on the project's overview page.

If you need to change which branch is considered MAIN, and therefore from where the README.md is read from, see Mainline branch identification.

Example project README with markdown

As well as the Markdown syntax that is supported in comments and described above, the README pages support a more extensive range of syntax, the most notable of which are described below. For a more thorough list of syntax, see here.

  • Headers can be defined using hash (#) marks.

    # Main heading
    ## Sub heading
    ### Lesser heading
    
  • Images can be added as well. You can either provide the full URL, or use a relative URL to reference something in Swarm.

    ![alt text](https://p4swarm/view/depot/www/dev/images/jamgraph-jam.gif "Title Text")
    
    ![alt text](/view/depot/www/dev/images/jamgraph-jam.gif "Title Text")
    
  • Tables are supported by using pipe (|) separators between columns and colons (:) for justification.

    | Tables   | Look   | Like this |
    | -------- | -----  | --------- |
    | Left     | right: | :center:  |
    
  • It is also possible to blockquote paragraphs using the greater than symbol (>).

    > Blockquotes can be displayed like this, using the
    > the greater than sign at the start of the line.
    
    Normal text resumes here.
    

If a README.md is displayed on the project overview page, then it appears above the activity stream.