Replies: 1 comment
-
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Product Feedback
Body
Frequently when sending people links to code, I want to highlight a specific block I am talking about. This can be done by adding a hash param to the URL (e.g.
.../path/to/file#L123-L456
).As far as I can tell, there is no way to select these lines by clicking and dragging down the line numbers or otherwise‡ so typically what I do is click the starting line number (in my example, 123) and then manually append
-L456
to the end. If I do that in the browser's URL bar and press enter, nothing changes. This is because changes to just the URL hash don't trigger a new page load, but rather emit ahashchange
event with the old and new URL.If I listen to these events with something like
window.addEventListener('hashchange', console.log)
, I can see the event fires with anoldURL
andnewURL
property containing the old and new URLs. It would be great if the page itself could subscribe to these and update the highlighted code, or at the very least trigger it's own refresh to render the "freshly loaded" version of the page.‡ Note: I did discover that if you select text on the right, then click one of the line numbers in between, it instead generates a URL of the form
#L12C3-#L45C6
, however I generally prefer to send whole line range selections than parts of the lines.Beta Was this translation helpful? Give feedback.
All reactions