CosmicPredator
CosmicPredator

Reputation: 109

Parse Markdowns in TextBlock in UWP .NET C#

I Want to parse a string which contains markdown and I also want to display the parsed markdown in the TextBlock of UWP App.

Some of the markdowns I want to parse :-

  1. __bold__
  2. _italic_
  3. ~!spoiler!~ - Here the text "spoiler" will be hidden and when I click it, it will show up the text.
  4. youtube("https://youtu.be/aUnak1") - This will embed a youtube video.
  5. [hyperlink](https://google.com) - Hyperlink.

Anyone has any idea how to achieve this in UWP App. If Someone knows please help me.

Thanks in Advnace...

Upvotes: 0

Views: 580

Answers (1)

FrozenAssassine
FrozenAssassine

Reputation: 1450

You can take a look at the Windows Community Toolkit it actually features a MarkdownTextBlock:

https://github.com/CommunityToolkit/WindowsCommunityToolkit/tree/rel/7.1.0/Microsoft.Toolkit.Uwp.UI.Controls.Markdown/

You can also take a look at the Windows Community Toolkit sample app:

https://www.microsoft.com/en-us/p/windows-community-toolkit-sample-app/9nblggh4tlcq

Upvotes: 2

Related Questions