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

New feature: Use line numbers as fragment identifiers to point a specific line, like what GitHub has #2327

Closed
dongskyler opened this issue Apr 24, 2020 · 2 comments · Fixed by #2328

Comments

@dongskyler
Copy link

Motivation

Use line numbers as fragment identifiers to point a specific line, like what GitHub has. It will be very convenient and useful to be able to refer to a specific line in the code.

Description

Just like in GitHub's code previews, when I click on a line number, a fragment identifier of #LXXX is appended to the URL. For example, if I click on line 16, "#L16" is appended to the existing URL.

I can use fragment identifiers to point to a specific line, when I visit a URL with a fragment identifier.

It will be a little tricky, when several code blocks are present on the same webpage. For example, if I have 2 code blocks (with more than 5 lines of code in each), when I want to refer to line 5 in the second code block, it will be a little tricky. There must exist some other form of identification/reference to distinguish among different code blocks. GitHub doesn't have this issue, because, I believe, GitHub only displays one code block on a webpage.

@RunDevelopment
Copy link
Member

This shouldn't be too hard to implement given that Line Highlight already implements most of the required features (see linking example).

@dongskyler
Copy link
Author

This is great

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

Successfully merging a pull request may close this issue.

2 participants