Skip to content

Support Quarto-style comment blocks #3557

@tomshafer

Description

@tomshafer

Describe the style change

Presently black inserts a space between the "#" and "|" in Quarto metadata comments like #| label: cell1.

Examples in the current Black style

Space is inserted between the hash and the pipe:

# | label: cell-no1
# | echo: false

Desired style

No space between the hash and the pipe, which breaks document metadata parsing:

#| label: cell-no1
#| echo: false

Additional context

Quarto is the new(ish) replacement for RMarkdown and uses these kinds of comments for metadata in, e.g., Jupyter cells and so black breaks document rendering. It would be nice to keep #| together in the same way as a couple of other comment pairs are preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.S: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedT: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions