Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add line highlighting #104

Merged
merged 1 commit into from
Jan 9, 2021
Merged

Conversation

erlliam
Copy link
Contributor

@erlliam erlliam commented Dec 26, 2020

Users can now click on the line numbers to highlight a line. They can share the link of the page and visitors will be scrolled to the line. The way this works is by storing the file number and line number in the hash of the URL.

Hash: #1L6
Will highlight the first file's 6th line.

pinnwand-line-hightlighting.mp4

Resolves #39

@supakeen
Copy link
Owner

Hey this looks awesome, could you retarget the PR to the development-v1.3.0 branch and include a CHANGELOG line perhaps? 👍

@erlliam erlliam changed the base branch from master to development-v1.3.0 December 31, 2020 13:22
@erlliam erlliam changed the title Add a line highlighter Add line highlighting Dec 31, 2020
@erlliam
Copy link
Contributor Author

erlliam commented Dec 31, 2020

Alright I did as you asked. I also had time to think about the code and I added some improvements. My reference for this feature was GitHub's line highlighting. Every time the URL's hash gets updated, you will be scrolled to that line except if you click a line number.

@supakeen
Copy link
Owner

Sounds pretty good I'll take a look at it somewhere this weekend and merge it!

@erlliam
Copy link
Contributor Author

erlliam commented Dec 31, 2020

Alright, I'll probably end up making some changes before then.

@erlliam erlliam force-pushed the master branch 2 times, most recently from 316a219 to 2d9d99b Compare January 1, 2021 04:08
Users can now click on line numbers to highlight a line.

Line highlighting works by storing the file number and line number in
the hash of the current page's URL.

Each time the hash changes, the line will be highlighted and the line
will be scrolled into view except if the user sets the hash by clicking
on a line number.

Example: #1L6
File 1, line 6 will be highlighted
@supakeen supakeen merged commit b0d9d48 into supakeen:development-v1.3.0 Jan 9, 2021
@supakeen
Copy link
Owner

supakeen commented Jan 9, 2021

Perfect, thank you. A 1.3 release will be upcoming somewhere in the next weeks with this included.

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.

Add a line highlighter
2 participants