You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><.styled_linkhref="some very long url and it goes on and on some very long url and it goes on and on some very long url and it goes on and on ">go home</.styled_link>.
</p>
to be formatted like this
<p><.styled_linkhref="some very long url and it goes on and on some very long url and it goes on and on some very long url and it goes on and on ">
go home
</.styled_link>.
</p>
which changes how it gets rendered on page (it adds extra whitespace before the period).
Whereas the a tag by itself is not forced to "line-break"
<p><ahref="some very long url and it goes on and on some very long url and it goes on and on some very long url and it goes on and on ">go home</a>.
</p>
^^^ this doesn't get re-formatted.
NOTE: I am aware of the phx-no-format workaround :)
Expected behavior
Formatting of components should have the same rules as normal elements. If a component consists of only inline elements, then it should be treated as an inline element itself.
The text was updated successfully, but these errors were encountered:
ruslandoga
changed the title
HTML formatter
HTML formatting rules for components made up of inline elements
Dec 11, 2024
ruslandoga
changed the title
HTML formatting rules for components made up of inline elements
components made up of inline elements should preserve whitespace
Dec 11, 2024
Honestly, I don't know what to do here. We could implement this, but then it means we have even fewer opportunities to format the user code. Perhaps one option is to make it a configuration option in the formatter? Something like:
👋
Environment
Actual behavior
Right now the HTML formatter treats all components as block elements, even if they consist of only inline elements.
This causes this component
in this template
to be formatted like this
which changes how it gets rendered on page (it adds extra whitespace before the period).
Whereas the
a
tag by itself is not forced to "line-break"^^^ this doesn't get re-formatted.
NOTE: I am aware of the
phx-no-format
workaround :)Expected behavior
Formatting of components should have the same rules as normal elements. If a component consists of only inline elements, then it should be treated as an inline element itself.
The text was updated successfully, but these errors were encountered: