Skip to content

Conversation

@jcoc611-microsoft
Copy link
Contributor

First step to making MarkdownTextBlock extensions configurable. Makes built-in Markdig extensions that have been implemented in the renderer configurable via properties. They are all false by default, but I'm open to changing that.

Adds the following properties:

  • UseAutoLinks
  • UseEmphasisExtras
  • UseListExtras
  • UsePipeTables
  • UseTaskLists

Example

<controls:MarkdownTextBlock
  Grid.Row="3"
  Config="{x:Bind MarkdownConfig, Mode=OneTime}"
  Text="{x:Bind Text, Mode=OneTime}"
  UseAutoLinks="True"
  UseEmphasisExtras="True"
  UseListExtras="True"
  UsePipeTables="True"
  UseTaskLists="True" />

@Arlodotexe
Copy link
Member

We'll want to add xmldoc comments to the new public-facing properties before merging.

@Arlodotexe
Copy link
Member

Arlodotexe commented Nov 26, 2024

Looking through the available extensions and docs at https://github.com/xoofx/markdig/tree/master/src/Markdig.Tests/Specs, there's a few more we might want to include.

Namely:

@nerocui
Copy link
Collaborator

nerocui commented Nov 27, 2024

For Mathematics support, I was just looking at that today. There's this wonderful library renders Latex, but it uses SkiaSharp which is not a dependency we want to take in the toolkit. Maybe we can leave off Latex support to third party or a separate package?

https://github.com/verybadcat/CSharpMath

@niels9001 niels9001 requested a review from Arlodotexe November 27, 2024 17:43
@jcoc611-microsoft
Copy link
Contributor Author

I added comments and added support for HardlineBreak since it works out of the box. For the other extensions, would probably address in separate PRs.

By the way, do we care about supporting changing the UseFoo properties during runtime? (i.e. should I bother to add a change callback to those properties and re-create the markdown pipeline & renderer when they change?)

@Arlodotexe
Copy link
Member

Arlodotexe commented Nov 29, 2024

For Mathematics support, I was just looking at that today. There's this wonderful library renders Latex, but it uses SkiaSharp which is not a dependency we want to take in the toolkit. Maybe we can leave off Latex support to third party or a separate package?

https://github.com/verybadcat/CSharpMath

Right, makes sense. Might be better to create a new Labs component to isolate the optional dependency, or to produce a third-party library instead. Let's leave this out while we weigh the options.

@Arlodotexe
Copy link
Member

Arlodotexe commented Nov 29, 2024

By the way, do we care about supporting changing the UseFoo properties during runtime? (i.e. should I bother to add a change callback to those properties and re-create the markdown pipeline & renderer when they change?)

Good question. I don't think most users will expect this functionality until they need it. Since we're in Labs, let's save that for a future PR when it becomes needed. We can file a ticket for tracking.

@jcoc611-microsoft jcoc611-microsoft marked this pull request as ready for review November 29, 2024 19:01
@Arlodotexe Arlodotexe moved this to 👀 In review in Toolkit 8.x Mar 11, 2025
@Arlodotexe Arlodotexe merged commit 519358d into CommunityToolkit:main Mar 14, 2025
21 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Toolkit 8.x Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants