Skip to content

introduce # fmt: off and # fmt: on tags to skip formatting within files #86

@dlaehnemann

Description

@dlaehnemann

This is a follow-up feature request to issue #85 that deals with comment formatting. Handling of one of the test cases there, with aligned comments across multiple lines to hide these lines during docs rendering, cannot be implemented easily within snakefmt.

As suggested in that issue's discussion, one workaround could be comment tags before and after respective sections that turn formatting off and then back on.

black has this and uses # fmt: off and #fmt: on, requiring both comments to be on the same indentation level. I think it would make sense to use exactly the same syntax, so that black users will already know it. And the naming makes perfect sense for snakefmt, as well.
In black, you should find the relevant code by searching for FMT_OFF in:
https://github.com/psf/black/blob/dea81b7ad5cfa04c3572771c34af823449d0a8f3/src/black/__init__.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions