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.

4 Answers 4

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}
2
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.

1
  • 1
    Can confirm that {code:json}{code} worked for me using version Jira 26eaabe8. Nov 8, 2018 at 16:45
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.

2
  • I think it could be possible to use Javascript highlighting instead of JSON.
    – Finkelson
    Nov 10, 2015 at 17:10
  • @Finkelson ... Your OP says it doesn't. Nov 10, 2015 at 17:30
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

2
  • I'm kinda looking for a free solution, but JEditor isn't free.
    – Finkelson
    Nov 10, 2015 at 19:17
  • have you followed this link..confluence.atlassian.com/jira/… for this your field need to be support for rich text.
    – Nuwan
    Nov 11, 2015 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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