Suppress leading/trailing whitespace from emitted markup
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
If a method returning markup contains whitespace, it will not be minified / trimmed. That makes the UI ugly, and we need to remember to format it to suppress the whitespace.
But the problem is created by the razor compiler, so the real fix is there. Instead of css hacks, one can do this:
```html
public void Foo() {@*
*@
Hello
*@}
```
That is also a hack, and is really ugly, but it works - no leading/trailing whitespace will be emitted. And that is the correct location for the solution. (Also one does not need to remember to add css hacks later.)
But that leads to another problem: that method looks weird when collapsed and makes the document hard to read. For the above example, without the hack, it correctly collapses to:
```
public void Foo() {...
```
But with the hack:
```
public void Foo() {@*
*@
*@}
```
I think there are two solutions:
- make it so the collapsed method looks good despite the interspersed `@*` and `*@`
- or better, trim whitespace from the emitted markup
Contributor guide
Assessment
This issue has not been assessed yet.