Add support for markdown -> XAML parsing#17585
Merged
Merged
Conversation
…s to a separate DLL
There was a problem hiding this comment.
check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
DHowett
requested changes
Jul 23, 2024
|
|
||
| namespace winrt::Microsoft::Terminal::UI::Markdown::factory_implementation | ||
| { | ||
| BASIC_FACTORY(Builder); |
Member
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
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. |
Member
There was a problem hiding this comment.
💭inline UI element with a Border?
lhecker
reviewed
Jul 24, 2024
This reverts commit 0c1157a.
DHowett
reviewed
Oct 11, 2024
DHowett
approved these changes
Oct 28, 2024
lhecker
approved these changes
Nov 4, 2024
This was referenced Nov 15, 2024
DHowett
pushed a commit
that referenced
this pull request
Nov 25, 2024
Instead of manually parsing out code blocks from the response we receive, leverage the markdown to xaml parsing introduced in #17585 ## Validation Steps Performed Responses are parsed as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
MarkdownPaneContentpane type onx-markdown(thex-is "experimental"). Go ahead and add that with:{ "command": { "action": "splitPane", "type": "x-markdown" } }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 ↩