Skip to content

HTML output doesn't honour indentation of attributes #71

@asilano

Description

@asilano

ReActionView is removing leading whitespace from lines which contain just an HTML attribute. This is totally valid HTML, but makes reading the rendered output much less pleasant (as well as messing up test snapshots when migrating from Erubi to ReActionView).

I assume this is ReActionView, rather than Herb, because the Herb formatter is not changing the indentation; it only happens on the rendered output.

Given the following template file:

<div>
  <div
    class="foo"
    role="dialog"
    aria-role="dialog"
    id="fooDlg"
    data-colour="chartreuse"
  >
    <p>Bar</p>
  </div>
</div>

Expected

The rendered HTML output should match - it should be:

Erubi output

<div>
  <div
    class="foo"
    role="dialog"
    aria-role="dialog"
    id="fooDlg"
    data-colour="chartreuse"
  >
    <p>Bar</p>
  </div>
</div>

Actual

The attributes get outdented back to column 0:

ReActionView output

<div>
  <div
class="foo"
role="dialog"
aria-role="dialog"
id="fooDlg"
data-colour="chartreuse"
>
    <p>Bar</p>
  </div>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions