Skip to content

Configurable tabsize in HTML reports #1342

Open
@Paebbels

Description

@Paebbels

Is your feature request related to a problem? Please describe.
In #6, it was reported that \t get handled in HTML reports.
When checking html.py this mentioned code seams to be gone.

When using tab characters for indentation in Python files, coverage.py converts all tabs to 8 spaces (checked in Chrome browser).
When checking the HTML source code, then 8 spaces can be found:

HTML Code HTML View
image image

Describe the solution you'd like
Offer an option in the configuration file, so the conversion of tab characters to spaces can be specified.

[html]
tabstyle = spaces
tabsize = 2

Or this

[html]
tabstyle = tabs
tabsize = 2

This would allow CSS to specify the representation with a default of 2.

Describe alternatives you've considered

  1. The documentation contains no options to configure the tab to space translation process.

  2. I think modifying CSS is not possible, because the HTML code contains already 8 spaces.
    So the representation of tab characters can't be modified.

    #source { padding: 1em 0 1em 3.5rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
    #source p { position: relative; white-space: pre; }
    #source p * { box-sizing: border-box; }
    #source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; }

Additional context


/cc @umarcor

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions