31

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?

  • Definitely a correct answer was given – New Alexandria Nov 3 '15 at 17:23
34

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}
  • The problem with this documentation is that it doesn't tell you how to specify something other than Java (say SQL, for example). – bcr Dec 16 '16 at 22:14
  • 7
    {code:<language>} such as {code:sql} for sql – relipse Jan 5 '17 at 15:14
  • 2
    The Advanced Formatting section has been updated to include all possible language types: 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. – JustaDaKaje Feb 7 at 17:25
2

By default it uses the Default Text Renderer on the Description field. You may need to edit your field configuration(s) (as admin) to use the Wiki Style Renderer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.