Prism is a {code} macro plugin for Atlassian Jira.

Code scan

Features

Build

Install Atlassian Plugin SDK and run atlas-package.

Usage

Multiple parameters can be specified by using | as separator, some parameters can have one or more values separated by ,:

{code:<param1>|<param2>=<value>|<param3>=<value1>,<value2>|...}
...
{code}

Default language is Ruby:

{code}
class Bar < Foo
  def initialize(a)
    @a = a
  end
end
{code}

Selecting language

Syntax: <language> as first parameter or language=<language> or lang=<language>

{code:java}
public class Bar extends Foo {
  private int a;

  public Bar(int a) {
    this.a = a;
  }
}
{code}

Setting title

Syntax: title=<title>

{code:title=prism.rb}
...
{code}

Enabling line numbers

Syntax: linenumbers or ln

{code:ln}
...
{code}

Setting start number

Syntax: start=<number> or firstline=<number> or fl=<number>

{code:ln|start=5}
...
{code}

Enabling soft line wraps

Syntax: wrap

{code:ln|wrap}
...
{code}

Highlighting lines

Syntax: highlight=<line(s)>,<range>,... or hl=<line(s)>,<range>,...

{code:hl=2,4-6}
...
{code}

Showing commandline with optional output

Syntax: cmd=<user>@<host>[><output line(s),<ranges>,...] or commandline=<user>@<host>[><output line(s),<ranges>,...]

{code:bash|cmd=siavash@localhost>2,5-30}
...
{code}

Known Issues

Visual editing in Rich Text Editor is not fully supported. While you don’t have to disable Rich Text Editor in Jira, you cannot use the visual tab to do code editing.

Notes

This plugin uses a slightly modified version of Prism to fix JS compile issues with Atlassian Plugin SDK.

This plugin is released without any support, if you want to add a new feature or fix a bug feel free to submit a PR.

Also check this Jira Server issue regarding {code} macro limitations and why this plugin was developed.

Privacy

see PRIVACY.md