Forums

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

How to Insert Code Snipped into Quoted text without having the Numbered List included?

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
May 15, 2024

Hi,

I have a question about Jira cloud: How can I insert a code snippet into a quoted text without having a Numbered List automatically included?

This was doable on Jira DC, but it's a bit of a pain to do in Jira cloud. Every time I try to add this, I get a Number List on the outside like:

cloud_comment.png

It would be great to know how this can be resolved.

Cheers,

Ram

 

2 answers

0 votes
Darryl Lee
Community Champion
May 16, 2024

Hi @Ram Kumar Aravindakshan _Adaptavist_ welp, I could not replicate this at all. No numbered list showed up when I did the following:

Steps I tried:

  • Insert Quote
  • Insert Code snippet

Results:

Screenshot 2024-05-16 at 9.03.05 AM.png

I feel like this might be similar to Confluence, which doesn't allow nested macros? You can look at how Jira stores the data by using the rest api and looking for your field (ex: https://YOURSITE.atlassian.net/rest/api/3/issue/BUG-6)

This is an excerpt of what I found:

{
"type": "blockquote",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Here is some code I hope"
}
]
}
]
},
{
"type": "codeBlock",
"attrs": {
"language": "none"
},
"content": [
{
"type": "text",
"text": "This is some code\nAnd some other code"
}
]
},

An interesting experiment might be to try updating Description with Automation, and try using Wiki Markup?

Darryl Lee
Community Champion
May 16, 2024

The question would be could you do this with Automation:

{quote}
This is quoted text
{code:xml} <test> <another tag="attribute"/> </test> {code}
{quote}

And the answer is.... nope. I made an Automation Rule to try to put this into a Description, and got this:

 Screenshot 2024-05-16 at 9.29.32 AM.png

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
May 16, 2024

Hi @Darryl Lee

Since you have the code snippet below the quote, do the following:-

1. Go into the quote, press enter once,

2. Go to the last line of the quote and click the delete button to bring the code snippet into the quote.

Cheers,

Ram

Darryl Lee
Community Champion
May 16, 2024

Oh neat! It almost works! So yeah, the API is showing that it NESTED the codeBlock into an orderedList.

Now I wonder what this looks like in Automation...

HUH when I output {{issue.description}} to the audit log, I see:

{quote}Here is some code I hope # {code:none}This is some code And some other code{code} Nope{quote} 

SOOOOO... yeah, I dunno. That looks very similar to what I tried to add via automation (without any spaces), except for the addition of the #.

Definitely a bug, I reckon.

0 votes
Dave Rosenlund _Trundl_
Community Champion
May 16, 2024

For some reason, @Ram Kumar Aravindakshan _Adaptavist_, I cannot reproduce this (unless I format the snippet as a numbered list).

 

Screenshot 2024-05-16 at 8.20.11 AM.png


Screenshot 2024-05-16 at 8.25.16 AM.png

 

Dave Rosenlund _Trundl_
Community Champion
May 16, 2024

Wait!  I just did another test. Once I added the numbered list format to the snippet, I could not turn it off.

However, I could copy the contents of the snippet; delete the snippet; create a new snippet block; and paste the copied text into it.

No more number outside the box. 

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
May 16, 2024

Hi @Dave Rosenlund _Trundl_

The test doesn't seem to be complete.

Could you try to repeat that test, this time try to add the code snippet into a Quote,  as shown in the image below:-


image1.png

 

Thank you and Kind regards,
Ram

Like Dave Rosenlund _Trundl_ likes this
Dave Rosenlund _Trundl_
Community Champion
May 16, 2024

Thanks, @Ram Kumar Aravindakshan _Adaptavist_. Some how I was missing the "inside a quote" piece of this. I can reproduce now and I can find no workaround. 

I think you discovered a bug 😱

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events