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
Describe the bug
A clear and concise description of what the bug is.
<Paragraph>
This example shows how to add a host object to the WebView. See <HyperlinkFontWeight="SemiBold"NavigateUri="https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.addhostobjecttoscript"UnderlineStyle="None">
here
</Hyperlink>
for more details about the AddHostObjectToScript API.</Paragraph>
<Paragraph />
With XAML Styler:
<Paragraph>
This example shows how to add a host object to the WebView. See<Hyperlink
On Save now with XAML Styler enabled, the significant space after See providing separation from the Hyperlink inline element is removed!
To Reproduce
Steps to reproduce the behavior:
When formatting the inline content of a RichTextBlock (WinUI)
<RichTextBlockIsTextSelectionEnabled="True"TextWrapping="Wrap">
<Paragraph>
This example shows how to add a host object to the WebView. See <HyperlinkFontWeight="SemiBold"NavigateUri="https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.addhostobjecttoscript"UnderlineStyle="None">
here
</Hyperlink>
for more details about the AddHostObjectToScript API.</Paragraph>
<Paragraph />
<Paragraph>
Using AddHostObjectToScript in a UWP app requires a different approach then the .NET based injection. See <HyperlinkFontWeight="SemiBold"NavigateUri="https://learn.microsoft.com/en-us/microsoft-edge/webview2/how-to/winrt-from-js?tabs=csharp"UnderlineStyle="None">
here
</Hyperlink>
for more details.</Paragraph>
</RichTextBlock>
See the spaces between See and the <Hyperlink are removed! They are significant in this context!
Expected behavior
Don't remove significant whitespace in Content text.
External Configuration
If you are using an external configuration, please attach to help reproduce the issue.
Version Info (please complete the following information):
OS: Windows 11 22631.4037
Visual Studio: VS 2022 17.11.1
XAML Styler: Extension 3.2404.2
The text was updated successfully, but these errors were encountered:
Please take a look at this section of the wiki on how we handle whitespace. There is this concept of "significant whitespace" in XAML that we need to maintain when formatting. If you are mixing inline-level flow content elements with other text (as in your example), you will want to specify xml:space="preserve" to preserve whitespace properly.
Thanks Dave, I don't think I knew about that attribute. 😲 This was from some sample other code I was using, so was confused initially by what was happening (thought it was a bug in VS at first until I remembered XAML Styler).
I'll have to see how that gets handled with the other indentation here and the output. 🤔
Adding xml:space="preserve" to the Paragraph elements does ensure that the space isn't removed on save. 🙂 But then the rest of the insignificant indentation whitespace gets included in the app rendering:
Any whitespace to the left of the closing quotes is removed from all lines of the raw string literal.
Though I would imagine this would be now a XAML Compiler thing where if it detects xml:space="preserve" on an element that it could do similar whitespace clean-up, but that'd be a breaking change in behavior...
Describe the bug
A clear and concise description of what the bug is.
With XAML Styler:
On Save now with XAML Styler enabled, the significant space after
See
providing separation from the Hyperlink inline element is removed!To Reproduce
Steps to reproduce the behavior:
See
and the<Hyperlink
are removed! They are significant in this context!Expected behavior
Don't remove significant whitespace in Content text.
External Configuration
If you are using an external configuration, please attach to help reproduce the issue.
Version Info (please complete the following information):
The text was updated successfully, but these errors were encountered: