What are the parameters to use for a code block in JIRA?
Asked by Paul Lin:

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:

{code:title=DateTimeUtil.java\|theme=FadeToGrey\|linenumbers=true\|language=java\|firstline=0245\|collapse=true}  
/\*\*  
\* 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 "";  
}  
{code}


Answers:
author: Shannon S
body: 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,  
Shannon

comments: author: Paul Lin
body: 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.

Thanks,  
Paul


author: Shannon S
body: 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:

* [Text Formatting Notation Help \> Advanced](https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=advanced)

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

* [JRASERVER-63346](https://jira.atlassian.com/browse/JRASERVER-63346) Add line number support to the {code} tag in Mark-up
* [JRASERVER-33995](https://jira.atlassian.com/browse/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:

* [Prism: Code syntax highlighting](https://marketplace.atlassian.com/plugins/com.catawiki.jira.prism/server/overview)

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,  
Shannon