Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Code Block Macro?

Deleted user February 26, 2019

I know it's available in Confluence, but can we implement it in Jira?

Everything I find refers to Confluence.

 

Thanks!

3 answers

1 accepted

0 votes
Answer accepted
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 26, 2019

Hi Tom,

I am not on the Jira team but I will try to help.

If your goal is to display code in various fields in Jira (like description, comments, etc.) then you can do so using the wiki-style markup.

https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=advanced

Eg. 

{code:title=Bar.java|borderStyle=solid}
// Some comments here
public String getFoo()
{
    return foo;
}
{code}

If you can't use this markup then you (or your admin) may need to configure the correct renderer.

https://confluence.atlassian.com/adminjiraserver/configuring-renderers-938847270.html#Configuringrenderers-wikirenderer

I hope that helps!

Deleted user February 28, 2019

Thanks Martyn!

Is there anyway to add a language?

It would be nice to have PowerShell.

Like Marty likes this
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2019

Hi Tom,

that page I linked to mentions the following

"Makes a preformatted block of code with syntax highlighting. All the optional parameters of {panel} macro are valid for {code} too. The default language is Java but you can specify others too, including ActionScriptAdaAppleScriptbashCC#C++CSSErlangGoGroovyHaskellHTMLJavaScriptJSONLuaNyanObjcPerlPHPPythonRRubyScalaSQLSwiftVisualBasicXML and YAML."

I think the closest to PowerShell will be bash.

You could try

{code:bash}
   ...
{code}

I hope that helps!

0 votes
Kenneth Lay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 25, 2019

This is very confusing because in Confluence markup-style code blocks are used (backticks)

0 votes
Mohamed Adel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2019 edited
Hi @Tom
What is the target of having this macro in jira ?!
Tom February 27, 2019

Hi

Ed
Contributor
July 30, 2020

The code block is for simple syntax highlighting of code or text. Jira hasn't caught up to Confluence yet (even after many years), so there are no "advanced" features, like line numbering, theming, support for many languages, or showing it in a collapsible panel.

Basically, what it does for you is shows you the literal text (without having to escape Wiki markup) inside the panel, in a distinctive font, and supports some syntax highlighting for a few of the most popular development languages. You can also control the color of the main text, the background color of the panel, and give your panel a header with a title for easy reference. But nothing fancy beyond coloring a few keywords from the language you've specified.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events