Skip to content

Make PR filenames headings and label the file contents#29

Merged
jcsteh merged 3 commits intojcsteh:masterfrom
SaschaCowley:gitHubDiffFixes
Aug 9, 2025
Merged

Make PR filenames headings and label the file contents#29
jcsteh merged 3 commits intojcsteh:masterfrom
SaschaCowley:gitHubDiffFixes

Conversation

@SaschaCowley
Copy link
Copy Markdown
Contributor

  • Makes the filenames in diff viewers level 2 headings.
  • Moves the filename first, rather than after a bunch of controls for that file.
  • Makes the file contents a region labelled by the filename. Useful when navigating by table rather than by heading.

let headerRow = el.parentElement
let children = Array.from(headerRow.children)
// Filename is the last child of .file-info, make it the first
children.unshift(children.pop())
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using Array.prototype.indexOf to find the index of the filename in the parent, then removing it by splicing and unshifting it to the start, but it seriously slowed things down for me. This assumes the filename is the last child of .file-info, which it always seems to be for me.

Copy link
Copy Markdown
Owner

@jcsteh jcsteh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'm really sorry. Looking at this, I don't honestly know why I never got around to merging it.

@jcsteh jcsteh merged commit 2b9a3c5 into jcsteh:master Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants