50

Is it possible to add a highlighted code to Jira comment? I want to write something like this:


The comment text and JSON doc:

{
  "key": 100
}

I've found only one example:

{code:javascript}
{
  "key": 100
}
{code}

But it does not really highlight my code. I see only the grey block.

Finkelson
  • 2,921
  • 4
  • 31
  • 49

4 Answers4

51

With the latest JIRA version you can do the following:

{code:json}
{
  "key": 100
}
{code}

You can also try to add only {code} at the beginning and end of your code block.

{code}
{
  "key": 100
}
{code}
Niwrad
  • 613
  • 5
  • 10
37

Recent Jira 7.5+ starts supporting more languages, including JSON.

Simply use:

{code:json}
...
{code}

See syntax highlighting in https://confluence.atlassian.com/jirasoftware/jira-software-7-5-x-release-notes-934719297.html#JIRASoftware7.5.xreleasenotes-tweaksMoreimprovements.

See documentation: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all

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.

CraZ
  • 1,669
  • 15
  • 24
3

Default JIRA highlighting syntax list

If you have the syntax highlighting plugin you have more, but no JSON as per its homepage and this ticket asking for JSON-specific support.

Confluence doesn't have JSON-specific highlighting as per the Confluence formatting docs.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
0

I think jeditor plugin will help you to find a solution it will support any type of code blocks you prefer.or you can use rich text editor for your field for more information follow the link and answer is also in here

Community
  • 1
  • 1
Nuwan
  • 1,226
  • 1
  • 14
  • 38
  • I'm kinda looking for a free solution, but JEditor isn't free. – Finkelson Nov 10 '15 at 19:17
  • have you followed this link..https://confluence.atlassian.com/jira/editing-rich-text-fields-185729567.html for this your field need to be support for rich text. – Nuwan Nov 11 '15 at 02:04