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?
2 Answers
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}
-
1The problem with this documentation is that it doesn't tell you how to specify something other than Java (say SQL, for example).– bcrDec 16, 2016 at 22:14
-
8
-
2The 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. Feb 7, 2019 at 17:25
-
2They document “Java” →
java
, but “Plain Text” → what?plain text
,plaintext
,plain-text
, etc.?– ændrükMay 24, 2021 at 17:20 -
1Just use
{code:none}
if you don't want any syntax highlight (or{noformat}
)– VRoxaDec 15, 2021 at 18:26
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