Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkdownTextBlock: Enable/Disable built in extensions #603

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jcoc611-microsoft
Copy link

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

@jcoc611-microsoft
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants