Using AJS to format the description

Hello, I want to display the Description of an Issue in my Plugin, but I get it in this form:

h2. Welcome to your first issue {color:#707070}An issue is an item you want to track in a specific JIRA project. You can use JIRA to track all kinds of things.{color} h4. Types of issues {color:#707070}An issue could represent a software bug, a user story, a project task, a helpdesk ticket, or a leave request form, the list is endless!{color} !IssueTypes.png! h4. Issue attributes {color:#707070}You may have noticed that an issue has some system fields such as: type, priority and status. These fields are there to help you categorise and track the progress of each issue.{color} Next: [Changing an issue's status|DEMO-2] \\ ---- [Learn more about issues|https://confluence.atlassian.com/display/JIRA/What+is+an+Issue] \\

How can I use AJS to format this,or the JiraAPI to do this?

regards

chris

2 answers

Javascript/Jquery

AJS.$(#description-val).text() will grab the description of an issue. you can trim() to remove white space. Obviously this is javascript so should be once page loads.

API

https://host:port/rest/api/2/issue/{issueid}

which will return your issue in json. Then you can assign it to a variable in javascript i.e. :

function getDescription()

{

var description;

AJS.$.ajax({

url: "/jira/rest/api/2/issue/TEST-1",

type: 'get',

dataType: 'json',

async: false,

success: function(data) {

description = data.fields['description'];

}

});

return description;

}

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

57 views 0 11
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