CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.88k stars 1.38k forks source link

Markdown parser: incorrect parsing of inline italics #3549

Open hol430 opened 3 years ago

hol430 commented 3 years ago

Describe the bug

Underscore characters placed inside a word without spaces around them (e.g. x_y_z) are treated as opening/closing an italic span. This does not appear consistent with the commonmark standard.

Steps to Reproduce

  1. Open sample app
  2. Open MarkDownTextBlock sample
  3. Add the following markdown to the textbox at the top:
x_y_z

Expected behavior

The underscores should be rendered. None of the text should be italicised.

Actual behaviour

The underscores are not rendered, and the 'y' character is italicised.

Environment

NuGet Package(s): 7.0.0-preview3

Package Version(s): 7.0.0-preview3

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [x] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [x] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: ) 
- [ ] 2019 Preview (version: )
ghost commented 3 years ago

Hello hol430, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

michael-hawker commented 3 years ago

Thanks @hol430, unfortunately our parser isn't perfect. We have an open issue to move to a standard Markdown parser. See #3200. Though I don't think we're going to get to that for 7.0 at this point.

If you think it's a simple fix, we do have unit tests in this area, so it may be possible to add one for this case, debug it, and then submit a fix if it's a simple one. We just updated our Wiki with better guidance on getting started.