Skip to content

Respect htmlWhitespaceSensitivity #140

@jake-penguins

Description

@jake-penguins

Prettier includes the option htmlWhitespaceSensitivity to control how to handle breaking lines that contain tags that get rendered as inline by default. This plugin doesn't appear to respect that option, instead always breaking the inner content onto a separate line, which causes tags like to render links with trailing whitespace. Effectively, htmlWhitespaceSensitivity is always set to "ignore".

Example input:

<p>If you didn't receive an email, please check your spam folder or <a href="{{ path('app_forgot_password_request') }}">try again</a>.</p>

Actual output:

<p>
    If you didn't receive an email, please check your spam folder or
    <a href="{{ path('app_forgot_password_request') }}">
        try again
    </a>.
</p>

Expected output (htmlWhitespaceSensitivity: "css"):

<p>
    If you didn't receive an email, please check your spam folder or
    <a href="{{ path('app_forgot_password_request') }}"
        >try again</a
    >.
</p>

Expected output (htmlWhitespaceSensitivity: "strict"):

<p
    >If you didn't receive an email, please check your spam folder or
    <a href="{{ path('app_forgot_password_request') }}"
        >try again</a
    >.</p
>

Would it be possible to add support for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    PrinterLogic related on how to print the output

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions