What are the parameters to use for a code block in JIRA?

I had gone to https://confluence.atlassian.com/doc/code-block-macro-139390.html to see the various parameters I can use in the code block. I've taken the example at the bottom of the page to copy from but so far only title seems to work for me. I.e. linenumbers, firstline, collapse all don't work. I tried language=java and it seems to work but it's not working for my JavaDoc comments.

My code fragment is as follows:

* Prints a list of days of week into a cohesive label that can be displayed properly.
* This takes into consideration that 1 means Sunday and 7 means Saturday and sorts it
* properly with Monday being the first day of the week. This also generates a range
* notation with " - " as a separator if there are consecutive days. Otherwise, this
* will list out days (and ranges) in a comma-separated way.
* @param daysOfWeek a List of Integers each representing a day of the week. It uses the
* Calendar field DAY_OF_WEEK as basis where 1 means Sunday and 7 means
* Saturday
* @return a prettily printed label that describes all the days that this List represents
public static String prettyPrint(List<Integer> daysOfWeek)
  return "";

1 answer

0 votes

Hi Paul,

Can you confirm if you're trying to do this in Jira or Confluence? Your title says Jira but the documentation and collection you chose is Confluence, so I want to make sure to give you the proper information.

Kind Regards,

Thanks Shannon for replying. I'm doing this in JIRA, but Googling brought me the Confluence link I pasted - it should really be the same anyway no? I'm saying this of course tongue-in-cheek because even though I made the decision to use an all-Atlassian stack including bitbucket, JIRA, Confluence, and HipChat, there are at least three different pseudo-mark-down ways to post code. And don't get me started on how to do bullet points :) BTW I can't wait to try Stride!

Anyway, I'm probably just nit-picking now because I'm fine just simply using {code} to demarcate my code fragments but wanted to learn more on how to use it fully.


Hi Paul,

No worries! The Jira code notation is going to be a bit different since the article you're reading for Confluence is based on a specific Confluence macro.

Here in the Advanced Text Formatting Notation for Jira you can see how you're able to use the {code} and {panel} macros:

I was also able to find a few requests for your missing features:

  • JRASERVER-63346 Add line number support to the {code} tag in Mark-up
  • JRASERVER-33995 Collapsible Content within a Comment (closed recently as Won't Fix)

One thing you might be interested in is this 3rd party add-on:

It seems to do the same thing as the {code} syntax but provides a lot more options. Perhaps it's worth giving it a try? 

Let me know if you have any questions about any of this. 

 Kind Regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

863 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you