speed-highlight / core

A lightweight syntax highlighter written in JavaScript
https://speed-highlight.github.io/core/examples/
Creative Commons Zero v1.0 Universal
276 stars 16 forks source link

[FEATURE] Configurable Line Number Display for Consistent Textarea Integration #48

Closed FogoVoar closed 3 months ago

FogoVoar commented 3 months ago

Is your feature request related to a problem? Please describe.

Yes, the speed-highlight library's line number display is frustrating when used with a textarea to make a code editor. Manually adjusting the textarea padding to fit the highlight overlay is a hassle, especially since the line number column changes behavior unpredictably. Sometimes it disappears with a single line of text, or shifts position depending on the language or content, making it inconsistent and annoying to deal with.

Describe the solution you'd like

It would be helpful to have settings to control the line number display. Specifically, options to toggle the line numbers on or off and to disable the feature that automatically hides them when there's only one line of text. This would make using speed-highlight with textareas much simpler and eliminate the need for manual adjustments.

Describe alternatives you've considered

A potential alternative is adding a native method for an editable area with working highlight. But that seems like a lot more work.

Additional context

Adding these settings would make speed-highlight much more practical for building code editors, getting rid of the need to fiddle with padding and alignment depending on different scenarios.

FogoVoar commented 3 months ago

Okay, apparently there are these options already. (I should read the docs before opening issues)