feat: wrap line mode #21 - #84
Open
lvolland wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
{ wrap: true }onhighlightText/highlightElement/highlightAll.the reason this was never a one-liner:
white-space: pre-wrapon the current markup wrapsthe text fine, but the gutter is a separate column of one div per source line, so as soon as
a line wraps the numbers slide out of step with the code.
the middle panel is what people reach for today — by line 8 the gutter is lying:
so in wrap mode each line becomes its own grid row — number cell, code cell — and a token
that spans a newline is split at the newline so every cell stays balanced.
cost
nothing else changes: the css goes in
default.css, which every other theme already@imports, and the number cells keep theshj-numbersclass so the six themes thatrecolour the gutter keep working.
verified
notes
{ wrap: true, hideLineNumbers: true }needs no grid at all, so it keeps the currentmarkup and only flips
white-space— no per-line splitting, no extra bytes in the outputcounter-reset: linemoves from.shj-numbersup to its parent. same result on theexisting markup, and it lets the grid reuse the counter
number. fix: a trailing newline adds a phantom line number #80 fixes that in the default path; happy to align both once you've picked a side
dist/