Skip to content

show-whitespace is wrong for tabs in markdown because of a GitHub bug #5708

@fregante

Description

@fregante

Please ensure:

  • The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.
  • The bug happens after clearing extension cache. The "Clear cache" button below can also be found at the bottom of the options page.

Example URLs

Extension version

22.5.22

Browser(s) used

Safari

Description

Custom tab size is broken for me: https://github.com/settings/appearance

Tabs are rendered as 8 spaces even my setting is for 2:

Screen Shot

This is because GitHub isn't adding any data-tab-size attributes in comments for me, even without RGH. I'm only seeing them on embedded code.

And for some reason we default to "4" instead of "8" in our code:

background-size: calc(var(--tab-size, 4) * 1ch) 1.25em;

Demo

Live:

 1 space
	1 tab

Screenshot:
Screen Shot 1

Solution

We have 2 options:

  • set a global default of 4 via non-specific selector: :where(:root) {--tab-size: 4; tab-size: 4}
  • change that default to 8

We should probably do both. The latter can be hotfixed.

Include in this issue:

  • Screenshots/video/gif demonstrating the bug, if it’s visual
  • Console errors, if any

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions