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.89k stars 1.38k forks source link

[Feature] Math formula support in MarkdownTextBlock #3020

Closed hez2010 closed 3 years ago

hez2010 commented 5 years ago

Math formula support

I hope that math formulas in markdown can be rendered correctly. For example:

# Math
Inline math formula: $ sum = \sum_{i=1}^n {x_i} $ (1)
Block math formula: 
$$ sum = \sum_{i=1}^n {x_i} $$ (2)

These cannot be rendered for now.

Solution

Support rendering math formula in MarkdownTextBlock. Maybe it can use katex to support math characters.

ghost commented 5 years ago

Thanks for submitting a new feature request! I've automatically added a vote reaction to help get things started. Other community members can vote to help us prioritize this feature in the future!

michael-hawker commented 5 years ago

Thanks for the suggestion @hez2010.

There doesn't seem to be the greatest consensus or support for syntax around math across markdown implementations at this time however.

It'd probably be best to look at it like a language in a traditional backtick fence block like:

    ```math
    sum = \sum_{i=1}^n {x_i}


I know @grochocki has been looking at math display for the calculator graphing mode, so he may have some good input on this space about the rendering side.
grochocki commented 5 years ago

Markdown math is interesting, though it seems much more closely tied to LaTex. I haven't done enough research to understand how widespread its usage is, but for Windows Calculator, we are looking at leveraging MathML, which definitely is a widely used standard.

Mathematical Markup Language (MathML) is a low-level specification for mathematical and scientific content on the Web and beyond (source). MathML or "pretty math" ensures that we are rendering math expressions in the same way that you might write the equation on a whiteboard.

microsoft/calculator#338

Rendering math is very complex, especially to cover the broad range of possible math expressions users may want to input.

yoshiask commented 4 years ago

Regarding actually rendering LaTeX expressions, there is CSharpMath. The Uno Platform team is working on adding support for Uno, which would work on UWP as well (without referencing the Uno packages).