Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add JSON highlighting to the code in Jira comment?

Tags:

jira

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.

like image 740
Finkelson Avatar asked Nov 10 '15 16:11

Finkelson


People also ask

How do I add a JSON file to Jira?

Select Import & Export > External System Import to open the Import external projects page. Select JSON to open the JSON File import page. Choose your JSON file. Click the Begin Import button when you are ready to begin importing your JSON file into Jira.

How do I add a JSON code block in Confluence?

Go to > General Configuration > Configure Code Macro. Choose Add a new language. Locate your language file and enter a Name for the new language (this will appear when selecting the language). Choose Add.

What text formatting does Jira use?

Jira Code Macro The languages supported are: 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. Java is the default language format used by the {code} block.


3 Answers

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

Example:

{code}
{
  "key": 100
}
{code}
like image 183
Niwrad Avatar answered Oct 16 '22 23:10

Niwrad


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.

like image 35
CraZ Avatar answered Oct 17 '22 00:10

CraZ


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.

like image 3
Dave Newton Avatar answered Oct 17 '22 01:10

Dave Newton