[Experiment] MarkdownTextBlock #536
Replies: 4 comments 10 replies
-
@nerocui can you give us a bit of an update as we're 3 months on from your initial post above, as to what you think the current state of the MarkdownTextBlock is? I've installed the pre-release '0.1.240517-build.1678' version to take a look at it, can already see some interesting issues with rendering code blocks and when the MarkdownTextBlock is inside of data templates, although still testing as to whether that's an issue specific to being inside of a data template or something related to binding. |
Beta Was this translation helpful? Give feedback.
-
I'm seeing an AOT compatibility issue with MarkdownTextBlock that roots from HtmlAgilityPack. Specifically, HtmlAgilityPack's I know the root problem lies with HtmlAgilityPack, but I was wondering if we can add a workaround here as well that avoids calling into If you guys are ok with it, I can create a PR for this too. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Proposal: ExtensionsThe underlying parser Simple properties for built-in extensions<md:MarkdownTextBlock UseEmphasisExtras="True" UseAutoLinks="True" Text="..." /> We can ship with a few Custom extensionsDeclaration in XAML: <md:MarkdownTextBlock Text="...">
<md:MarkdownTextBlock.CustomElements>
<foo:CustomElement />
</md:MarkdownTextBlock.CustomElements>
</md:MarkdownTextBlock> And C#, implementing a new interface we ship class CustomElement : IElement<CustomObject>
{
// Parsing
public void AddToPipeline(MarkdownPipelineBuilder pipelineBuilder)
{
pipelineBuilder.Extensions.Add(...);
}
// Rendering
public UWPObjectRenderer<CustomObject> GetObjectRenderer() => new CustomRenderer();
} With this approach, we can allow users to add arbitrary extensions on top of the control in a very simple and declarative manner. A quick glance at the XAML tells you all the built-in and custom extensions currently being used. |
Beta Was this translation helpful? Give feedback.
-
We've opened a tracking issue we're going to start populating with the known issues and open work for the control here: #606 - It'll be the first use of the new sub-issue feature for us too. Looks promising for us to split out individual issues for components but have them tied to our central tracking issue. 🎉 |
Beta Was this translation helpful? Give feedback.
-
MarkdownTextBlock
Problem Statement
The existing MarkdownTextBlock in the toolkit is old and out of maintenance. It's based on custom parser code and the users have been requesting more features and bug fixes.
Proposed Solution
Since in .NET ecosystem, there's already an existing state of the art markdown library, Markdig, it'd be in our best interest to integrate that into a new MarkdownTextBlock and explore the various possibilities it brings.
Open Questions
Code: https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/MarkdownTextBlock
Initial PR: #480
Tracking Issue: #606
Beta Was this translation helpful? Give feedback.
All reactions