docs-maui
docs-maui copied to clipboard
label with textType HTML not showing code elements content as code block.
Description
I am trying to show chatgpt messages in the correct format but code blocks not show the code as code blocks. For example the output of the following should be the inside of the code elements
<code>
<label for="name">Name (4 to 8 characters):</label>
<input type="text" id="name" name="name" required minlength="4" maxlength="8" size="10" />
</code>
but the result is: Name (4 to 8 characters):
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
9.0.30 SR3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
https://developercommunity.visualstudio.com/t/label-with-textType-HTML-not-showing-cod/10845891?port=1025&fsid=7eb83638-a5ce-4018-9201-ac6688bdfc94
@PureWeen, I'm not sure why this would be a VisualStudio issue. The user tried using Code Tags inside their label, with the text type set to HTML.
https://github.com/drasticactions/MauiRepoRedux/tree/tag-test
I have an example of setting the TextView/UILabel in Android/Mac Catalyst using HTML strings, as MAUI does for its label.
This issue is complicated based on how the MAUI UI code is implemented. It's not a MAUI UI bug but more a missing feature of Android. It doesn't handle code blocks with Html.FromHtml, which MAUI uses to render these blocks. iOS/Catalyst does by default. MAUI has never handled the code block and neither did Xamarin.Forms.
So, this does not seem to be something that has regressed. It has never done this. Google does not list the elements that work for Html text either, https://issuetracker.google.com/issues/167925056.
That said, it should be possible for it to be implemented via a TagHandler (https://learn.microsoft.com/en-us/dotnet/api/android.text.html.itaghandler?view=net-android-35.0) but now it's, IMO, a new feature. I think the right thing to do is document which tags work with each platform and then discuss if something like this should be added.
Apologies @stelios888
I misread the issue