Is there a way to get markup to display referenced issue name?

I can easily reference other issues, even in different repos using #.

But while it shows the issue name in a tooltip or in autocomplete while typing, adn the _referenced_ issue gains a link to the new issue-name, my new issue only displays the issue ID.

Is there no way to have it show the issue title which is far more human-readable?

Hi @jdx-john,

There’s no built in way to do that on our end, but I will share this with the appropriate team as a feature request for future consideration. That said,  you could try using this bookmarklet to copy issue titles & URLs in markdown format as a workaround.

Cheers!

1 Like

Thanks on both counts :slight_smile:

To follow this up, I’ve been using that bookmarklet but want to tweak it slightly and lack to web-dev skills to understand the DOM manipulation enough.

The code is 

javascript:(function()%7Bvar a,b,c%3Ba%3Ddocument.createElement("textarea"),b%3Ddocument.getElementsByTagName("h1")%5B1%5D.children%5B0%5D.textContent.trim(),c%3Dwindow.location.href,a.value%3D"%5B"%2Bb%2B"%5D("%2Bc%2B")",document.body.appendChild(a),a.select(),document.execCommand("copy"),a.remove()%7D).call(this)%3B

So if I navigate to https://github.com/github/hub/issues/1913 and run it I get:

[ability to list reviewers with the --format flag](https://github.com/github/hub/issues/1913)

I would like it to include the issue number in the title. e.g.

[193 - ability to list reviewers with the --format flag](https://github.com/github/hub/issues/1913)

I can see that the code is getting the H1 element and that does contain the number, but in a second <span> element. Equally, it is encoded in the URL but that might get messy to detect if I follow a comment link as it isn’t always the last part of the URL.

For someone who knows this stuff it must be trivial, for me it could take an hour or more mucking about!

Hi @jdx-john,

Unfortunately, the bookmarklet code seems to have changed all special characters back into their HTML code and I’m having difficulty converting that back into its proper format. You wouldn’t happen to have a Gist of that code, would you? I’d love to poke at it and see if I can help you make this modification.

Thanks!

I just got it from the link a couple of posts above…

Sorry, didn’t realized that it wasn’t modified from that.

Alright, I reviewed the source code from this script. It looks like the line where we get the title is here:

title = document.getElementsByTagName('h1')[1].children[0].textContent.trim()

I used the Google Chrome Developer Tools to try out variations of this line to see what resulted. The .children[0] is particularly interesting to us as it tells us to select the first span tag inside the H1 and to use that as the title. If we used .children[1] however, it gives us the issue number.

Depending on how you want this to be formatted, you could remove the .children[X] entirely and the rest of the code will just give you the raw text data in the issue title which will include the issue number, or you could store the issue number in a separate variable to format the link however you’d like.

Hope that helps! Please let me know if you have additional questions. :slight_smile: