Markdown

You can use Markdown to add text styles to comments and project overview pages. Swarm can also display Markdown files stored in the Helix Core server. Markdown is not supported in the Swarm review description.

In this section:

Common Markdown styles

A number of the more common Markdown styles are shown below, for a more thorough list of the styles you can use, see the Markdown cheatsheet:

  • 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);
    ```
  • 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 Swarm view URL, or use a relative Swarm view URL to reference something in Swarm.

    ![alt text](https://swarm.company.com/view/depot/www/dev/images/jamgraph-jam.gif "Title Text")
    ![alt text](/view/depot/www/dev/images/jamgraph-jam.gif "Title Text")
    Tip

    To find the Swarm view URL for an image file:

    1. From Swarm, click on the Files tab and navigate to the image file.
    2. Click on the image file so that it opens in the View tab.
    3. Click the Open button for the file to open the image in you browser.
    4. The URL in your browser address bar is the Swarm view URL for the image file.
  • 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.

Markdown example

The following example shows how Markdown text can be used in a comment but it would display the same for a project overview page.

The source and the final result are shown:

Source text

*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. Use the backslash character \ to escape Markdown syntax characters. You can escape the following characters: Asterisk \* Underscore \_ Curly braces \{ \} Square brackets \[ \] Brackets \( \) Hash \# Plus \+ Minus \- Period \. Exclamation point \!

Rendered view of Markdown text

Image Showing All Supported Markdown Styles

Markdown in comments

Markdown content is displayed in comments, but Markdown support is limited to prevent execution of raw HTML and JavaScript content.

If you use Markdown styles in your comments, Swarm renders them when you post the comment.

Tip

Try to avoid using Markdown styles like headers, images, and tables in comments, they can make comments harder to read this is especially true inline comments.

Image of an Example Comment with Markdown

Markdown in projects

If a project has a README markdown file in the root of its MAIN branch, that README markdown file is displayed as the overview page for the project.

By default, Markdown content is displayed on the project overview page but is limited to prevent the execution of raw HTML and JavaScript content. This can be configured by the Swarm administrator.

  • Markdown support for displaying the project overview page can be disabled by your Swarm administrator, see Project readme.
  • The level of Markdown support can be configured by your Swarm administrator, see Markdown.

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

Tip

Valid Markdown file extensions are: md, markdown, mdown, mkdn, mkd, mdwn, mdtxt, mdtext.

If more than one README file is found, Swarm displays the first one it finds based on the order above.

Project overview tab image