Skip to content

Instantly share code, notes, and snippets.

@JJTech0130
Last active December 5, 2025 10:49
Show Gist options
  • Select an option

  • Save JJTech0130/09c0e1122f5e06dd341fd3e348085d00 to your computer and use it in GitHub Desktop.

Select an option

Save JJTech0130/09c0e1122f5e06dd341fd3e348085d00 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name GitHub Project Issue Numbers
// @namespace https://jjtech.dev
// @description Appends issue numbers to issue titles
// @version 0.7
// @require https://code.jquery.com/jquery-3.6.0.slim.min.js
// @match https://github.com/*
// @icon https://github.githubassets.com/pinned-octocat.svg
// @inject-into content
// ==/UserScript==
function updateIssueNumbers() {
$('[class^="interactive-item-title"]').each( function() {
// Check if we have already added an issue number
if ($(this).data('gh-issue-num') == undefined) {
num = $(this).attr('href').split('/').pop()
// Get the parent's parent's previous siblings's first child's first child's text
$($($(this).parent().parent().prev().children().get(0)).children().get(0)).text("#" + num)
//$(this).text("#" + num + ": " + $(this).text())
$(this).data('gh-issue-num', num)
}
})
}
const callback = function(mutationList, observer) {
updateIssueNumbers()
}
// Create an observer, so that we can re-add issue numbers if a new issue is added
new MutationObserver(callback).observe($('body')[0], { childList: true, subtree: true });
@JJTech0130

Copy link
Copy Markdown
Author

Click the "Raw" button to install it

@JJTech0130

Copy link
Copy Markdown
Author

If you liked the old version (which added the issue number to the title, rather than replacing the numbers on the left, go to this link https://gist.github.com/JJTech0130/09c0e1122f5e06dd341fd3e348085d00/8f8a5bc2acf6b72ae476ef716f955ebe19776489

@JJTech0130

Copy link
Copy Markdown
Author

There's a bit of a bug right now: If you re-arrange the columns, it replaces the content of the column before the issue title with the issue number, even if it's not the correct column

@hdm12345

hdm12345 commented Dec 5, 2025

Copy link
Copy Markdown

Hi! I tried to use this in one of my projects but unfortunately it's not working.

I tried to debug the script (using ChatGPT, sorry I'm a bit of a github scripts newby myself). But while it did eventually succeed in adding the # to the beginning of the issue, it was not able to remove the original 1-2-3-4-5 numbering of the issues, nor the # at the end of each issue title! Nice idea though!! Thank you.

This was the final script chat and I came up with:

// ==UserScript==
// @name GitHub Projects Clean Issue Numbers
// @namespace https://jjtech.dev
// @Version 0.4
// @description Remove redundant numbering in GitHub Projects (new UI)
// @match https://github.com/*/projects/*
// @grant none
// ==/UserScript==

(function() {
console.log("🔢 GitHub Projects Clean Issue Numbers loaded…");

function processCards() {
    // Find all project cards with links to issues
    const cards = document.querySelectorAll('a[href*="/issues/"]');

    cards.forEach(link => {
        const cardTitleNode = link.querySelector('span');
        if (!cardTitleNode) return;

        if (cardTitleNode.dataset.cleaned) return;

        let title = cardTitleNode.textContent;

        // Remove trailing #<number>
        title = title.replace(/\s?#\d+$/, '').trim();

        // Extract issue number from URL
        const match = link.href.match(/issues\/(\d+)/);
        if (!match) return;

        const number = match[1];

        // Prepend #<number> at start
        cardTitleNode.textContent = `#${number} — ${title}`;

        // Mark as processed
        cardTitleNode.dataset.cleaned = 'true';

        // Hide left-side numbering (if any)
        const row = link.closest('div[role="row"]');
        if (row) {
            const leftNumber = row.querySelector('div[role="gridcell"] span');
            if (leftNumber) leftNumber.style.display = 'none';
        }
    });
}

// Observe for dynamic content changes
const observer = new MutationObserver(processCards);
observer.observe(document.body, { childList: true, subtree: true });

// Initial run
processCards();

})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment