jgm / skylighting

A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions
190 stars 61 forks source link

Indicate wrapped lines #75

Open dbaynard opened 5 years ago

dbaynard commented 5 years ago

I've added some css that introduces a discreet, linear gradient where lines wrap (in print css, only). The second commit restricts it to the case without line numbers, only. The image shows an example.

no-line-nos-cont

I tried to use a continuation character (with an svg background image), but it gets quite complicated to repeat the character without it appearing on the first line, too.

I'm not entirely convinced with the appearance, but the principle seems to work — and for print css it at least indicates line wrapping.

dbaynard commented 5 years ago

The code is missing comments — I'll add them if you want to merge.

mb21 commented 5 years ago

I like the idea! I did some quick testing:

I needed to remove the background-size to see anything. And I'd probably do the following:

background: linear-gradient(to right, #e4e4e4, #ffffff) no-repeat;
background-position: 3.5em 1.25em;

The grey is on the left, because that's where the "virtual" line starts, then fades to the right into the background.

btw. the left: -4em; on the pre.numberSource code > span has the apparent effect of creating a margin to the right of the code blocks (you see it on small screens), so maybe add a margin-right: -4em; there?

jgm commented 5 years ago

I like this too. @dbaynard - want to add comments and take into account @mb21's comments? (The gradient is a stylistic issue, I don't really have an opinion on it but would be happy to leave it to your judgment, but the issue about background-size seems more serious, as does the margin issue.)

jgm commented 5 years ago

I'd like to get these changes figured out soon, since I just fixed a major parsing bug and I'd like to push out a new release...want to make sure the CSS issues are fixed first.

mb21 commented 5 years ago

@jgm fairly certain you can also ship the release without this pull request. This just adds a new feature (line-wrapping) when printing the HTML doc.

dbaynard commented 5 years ago

Yes, I'll make the changes. But I agree with @mb21 — better not to rush this?

jgm commented 5 years ago

David Baynard notifications@github.com writes:

Yes, I'll make the changes. But I agree with @mb21 — better not to rush this?

Thanks: I already released my changes, so there's no longer any urgency on this.