valiantys-logo
Back

Jira code formatting: A few quick tips

Jira Software is widely used by development teams to plan, track and release software – meaning that it better be easy to find and read the code you need. Jira code formatting makes the code more readable and meaningful, as it is able to convey the intent to the reader. When the code block gets a bit complex, lack of formatting make it difficult to understand – thus the need for a good layout to make the code comprehensible. Poorly formatted code is an immediate red flag that the code probably doesn’t follow best programming practices.

Rather than having these code block as simple texts in the Description or the Comments fields, Jira has a variety of code formatting options which enables the developer to comply with coding standards. The formatter manages the readability of the code block according to the specified language, Java being the default. Here are the renderers that Jira supports, to control the behavior or style of the text being entered into the Text fields and drop-down fields.

Renderers

Jira renderers control the style in which the content of a Jira field is displayed. Any text-based field or multi-select fields in Jira can be rendered. The following are the types of renderers supported by Jira.

Default Text Renderer: This renderer uses plain text mode to display the content in the specific field. It also has some additional functionality like auto-linking. Whenever a Jira ticket number is encountered in the content being entered in a particular field, a hyperlink to that ticket number is created instead of the ticket number text.

Wiki Style Renderer: This renderer allows the use of markdowns to generate HTML content. This allows advanced formatting for code blocks that users enter into the Description field and the Comments field.

Configuring Renderer

Jira allows administrators to customize the type of renderer used by the fields. This can be achieved by modifying the Field’s Default Renderer in the Field Configuration. The Field Configuration contains the “Renderers” configuration option against each field.

 

The “Active Renderer” option allows you to choose the Default Renderer for the field (In this case, the “Description” field).

Jira Code Macro

The {code} macro allows for pre-formatted code block with syntax highlighting in the description and the comments field.

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. Typing the code block in the Text editor shows the code, whereas the Visual Editor applies the markdown directly.

The following sample codes will give an insight on the various formats for code blocks, based on the language used. Here are a few examples:

Java Code Block

Below is an example of Java code block in the editor, after the markdown is applied:

Here is a Java code block with a title:

JSON Code Block

The JSON Code block in the Editor and after the markdown is applied.

SQL Code Block

The SQL Code block in the Editor and after the markdown is applied.

Hopefully these quick tips will help your team navigate their code easier in Jira! If you are looking for more advice around Jira Software, our Atlassian certified consultants hold regular training sessions. Hop over to our website and sign up for the training that best fits your schedule.

Cutted Triangle

Subscribe to Valiantys Newsletter

Registered request ! Subscribing... This is not an email An error occured

In accordance with our privacy policy, we are committed to respecting your personal data.

Contact us

Our Atlassian certified consultants will be happy to answer you.

Join us

We're building the next dream team - Are you in?

Follow us

We use cookies for the operation of our website. This is to improve its use, to personalize your experience, and to compile visitor statistics. By continuing to use this site, you consent to this policy. You can manage the settings and choose whether or not to accept certain cookies whilst browsing. For more information, see our privacy policy. Our privacy policy

Privacy settings

In order to facilitate your navigation and to provide you with the best possible service, we use cookies to improve the site to the needs of our visitors, particularly according to the number of visitors. For more information, please read our privacy policy. Our privacy policy

Recaptcha

Google reCAPTCHA is a system designed to distinguish humans from computers, so that bots are unable to maliciously fill out forms on behalf of a human being.

Analytics

Used to send data to Google Analytics about the visitor's device and behavior. Tracks the visitor across devices and marketing channels. Used by the social sharing platform AddThis to store the user's usage history of the AddThis sharing widget. Registers a unique ID that is used to generate statistical data on how the visitor uses the website.