Closed horo-fox closed 4 months ago
<p>
tag isn't whitespace-sensitive: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p , but formatting output can be optimized.
Ah, maybe whitespace-sensitive is the wrong term. I was just referring to how when you add a newline in a <p>
tag (with white-space: normal
) the browser acts like there's a space.
Thanks for the plugin, by the way!
What about the output below?
<MainLayout>
<div class="grid-container">
<article>
<details>
<summary>More about me!</summary>
<p>
<a href="url">contents</a>.<b>blah</b>@blah.
</p>
</details>
</article>
</div>
</MainLayout>
If it looks good, I will fix as this.
Looks fine like that, yeah!
Please consider recommending this plugin to more people, especially to Astro community as it works better than "prettier-plugin-astro" with expressions. A big problem of this plugin is that it's not widely known and popular enough.
Thanks! FYI I think that the commit seems a bit off (e.g. <p><b>a</b>\nc</p>
is essentially <p><b>a</b> c</p>
, but both are different than <p><b>a</b>c</p>
. e.g. keeping whitespace or removing it is important (though the number of whitespaces doesn't)).
However it's off in a better way than it was before: it seems to try hard to remove whitespace, which can easily be readded via an expression {" "}
. And it works for my needs.
I was running this over my
astro
site (because their prettier plugin doesn't work well with expressions) and I noticed one deviation that's weird: this turned<b>part1</b>@part2.com
into<b>part1</b>\n@part2.com
. This is within a<p>
tag, so whitespace is significant: therefore, this turns what was an copy-able email address intopart1 @part2.com
.My site is open source: https://github.com/horo-fox/horo.services, the regression is in
src/pages/index.astro
. My only configuration is (indprint.json
):