PrismJS / PrismJS/prism

Line-Highlight Vertical Centering Option

Open
#839 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement plugins
Dominant language
JavaScript
Stars
13k
Forks
1.4k
Avg merge
15h 36m
Merged PRs (30d)
3

Description

Right now, the line-highlight plugin uses scrollIntoView() to cause the highlighted lines to appear at the top, when the page is loaded using the hash syntax. It would be useful if there were an option to have the lines be vertically centered instead, to provide context on both sides of the highlighted lines. I tried hacking that in myself, but my JavaScript-fu is weak...

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the line-highlight plugin's hash-loading path, especially where scrollIntoView() positions highlighted lines. Define the option's expected behavior there and verify that hash-based highlighting can position the lines vertically centered while preserving the existing default.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.