Jira – Format Code Block Without Markdown Plugin

jira

Jira (hosted version) does not seem to support Markdown without a plugin. How can I paste and format a code block in a Jira issue comment or description?

Best Answer

The Atlassian JIRA {code} macro is covered in section Advanced Formatting within the Text Formatting Notation Help:

Makes a preformatted block of code with syntax highlighting. All the optional parameters of {panel} macro are valid for {code} too. The default language is Java but you can specify others too, including ActionScript, Ada, AppleScript, bash, C, C#, C++, CSS, Erlang, Go, Groovy, Haskell, HTML, JavaScript, JSON, Lua, Nyan, Objc, Perl, PHP, Python, R, Ruby, Scala, SQL, Swift, VisualBasic, XML and YAML.

Example:

{code:title=Bar.java|borderStyle=solid}
// Some comments here
public String getFoo()
{
    return foo;
}
{code}

{code:xml}
    <test>
      <another tag="attribute"/>
    </test>
{code}
Related Topic