-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add support for markdown -> XAML parsing #17585
base: main
Are you sure you want to change the base?
Conversation
…s to a separate DLL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
||
namespace winrt::Microsoft::Terminal::UI::Markdown::factory_implementation | ||
{ | ||
BASIC_FACTORY(Builder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't be created, doesn't need a factory.
Consider finding a way to do away with this. There's something fully static classes can do to not need a factory at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I can? Converters
in MTUI does the same thing, and it's got a ctor. I couldn't find anything this morning that talked about disabling factory_implementation
for a pure static class.
KeyChordSerialization.h
also has this ominous comment in it:
// C++/WinRT generates a constructor even though one is not specified in the IDL
break; | ||
|
||
case CMARK_NODE_THEMATIC_BREAK: | ||
// A <hr>. Not currently supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭inline UI element with a Border?
This reverts commit 0c1157a.
This adds support to the Terminal for parsing Markdown to XAML. We're using https://github.com/github/cmark-gfm as our parser, so that we can support the fullness of github-flavored markdown.
The parser parses the markdown to produce a
RichTextBlock
, which covers just about all the scenarios we need. Since we're initially just targeting using this for "Release notes", I didn't implement everything in markdown1. But headers, bold & italic, unordered lists, images, links, code spans & blocks - all that works. We can work on additional elements as we need them. The parser is encapsulated intoMicrosoft.Terminal.UI.Markdown.dll
, so that we won't load it on startup, only when the pane is actually made the first time.To test this out, I've added a
MarkdownPaneContent
pane type onx-markdown
(thex-
is "experimental"). Go ahead and add that with:That's got the ability to load arbitrary MD files and render them. I wouldn't call that experience finished though23(and it probably won't be in 1.22 timeframe). However, it is an excellent testbed for validating what we do and do not support.
We'll use the markdown parser SoonTM for the What's New panes.
Footnotes
the most notable gap being "block quotes" with
>
. I don't think I can draw a vertical line in a rich text block easily. Footnotes are also missing, as well as tables. ↩I say it's not finished because the aforementioned MD gaps. Also the UX there is not polished at all. ↩
I don't believe we'll have time to polish out the pure markdown pane for 1.22, but what the parser covers now is more than enough for the release notes pane in time for 1.22 ↩