Skip to content

Closing Bracket of start tag added to new line #92

@andrewdowis

Description

@andrewdowis

Description

I am requesting a markoClosingBracketNewLine: boolean option which will effect where a closing bracket appears in relation to the opening bracket of a start tag, its attributes, and the child elements. Currently in Marko ^6.0.0

<my-tag
    attr1="attr"
    attr2="attr"
    attr3="attr"
    attr4="attr"
    attr5="attr">
    TEXT
</my-tag>

Would prefer:

<my-tag
    attr1="attr"
    attr2="attr"
    attr3="attr"
    attr4="attr"
    attr5="attr"
>
    TEXT
</my-tag>

Why

It creates a visual distinction between the opening of the start tag, the attributes, its content, and the closing of the start tag. Currently, the child (eg: TEXT) is in line with the attributes without any tabs, spacing, breaks, etc to separate it. That makes it look like an attribute, and is visually unclear.

What happens if I want to comment out the last attribute? Using VS Code to just CMD+/ a line, it would result in

<my-tag
    attr1="attr"
    attr2="attr"
    attr3="attr"
    attr4="attr"
    // attr5="attr">
    TEXT
</my-tag>

which now removes the closing bracket and breaks the code entirely. Extra effort is needed to correct this.

How can it benefit other users?

  • Visual clarity
  • Fewer manual actions to comment out attributes and move closing bracket
  • Parity with other libraries and formatters

Is this something you're interested in working on?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions