gatsby-remark-vscode
gatsby-remark-vscode copied to clipboard
Table layout causes diff and line highlight errors
Hi, first of all, thanks for the awesome plugin!
While testing in IE and in modern webkit browsers, I discovered few issues. The common culprit seems to be usage of table layout and the fact that relative positioning of elements is not always respected in this layout.
- In IE line hightlight is not displayed at all, because of custom variables, which I guess is ok. If you set regular background-color you'll find that
grvsc-line::before
pseudoelement is mispositioned:
- In modern Chrome, Safari and Edge, however,
position: relative
ondisplay: table-row
ongrvsc-line
is not respected, which results inwidth: 100%
applied togrvsc-line::before
being equal to the width ofgrvsc-container
and notgrvsc-line
. It causes problems with highlight beyond horizontal overflow:
Those styles seems to work as a workaround:
.grvsc-code {
position: relative;
width: 100%;
}
.grvsc-line {
position: static;
}
Firefox has no issues:
Sources:
Hmm, you’re very correct... unfortunately, making .grvsc-code
100% wide when the code doesn’t take up the full width makes the gutter cells grow (they’re supposed to be flush left):

I’ll keep experimenting. Thanks for the heads up!
Thanks for looking into the issue. I admit I haven't run the tests while testing my solution. It's just what works for me right now.
I think CSS Grid might be a viable solution here. Not sure when I’ll have time to give it a try.