Add support for markdown -> XAML parsing (#17585)

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 markdown[^1]. 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 into
`Microsoft.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 on
`x-markdown` (the `x-` is "experimental"). Go ahead and add that with:

```json
{ "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 though[^2][^3](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 Soon<sup>TM</sup> for the What's New
panes.

* Done in pursuit of displaying release notes in the Terminal.
* Doesn't quite close out #16495 
* Should make #8647 possible
* may help with #16484

[^1]: 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.
[^2]: I say it's not finished because the aforementioned MD gaps. Also
the UX there is not polished at all.
[^3]: 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
This commit is contained in:
Mike Griese
2024-11-12 10:18:11 -08:00
committed by GitHub
parent 52262b05fa
commit 772f546ac4
33 changed files with 1775 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ breadcrumbs
ccmp
ccon
clickable
cmark
CMMI
colorbrewer
consvc
@@ -22,6 +23,7 @@ Emacspeak
Fitt
FTCS
gantt
gfm
ghe
gje
godbolt

View File

@@ -43,6 +43,7 @@ DONTADDTORECENT
DWMSBT
DWMWA
DWORDLONG
EMPH
endfor
ENDSESSION
enumset
@@ -62,6 +63,7 @@ GETDESKWALLPAPER
GETHIGHCONTRAST
GETMOUSEHOVERTIME
GETTEXTLENGTH
HARDBREAKS
Hashtable
HIGHCONTRASTON
HIGHCONTRASTW
@@ -115,6 +117,7 @@ IUri
IVirtual
KEYSELECT
LCID
LINEBREAK
llabs
llu
localtime
@@ -148,6 +151,7 @@ NIF
NIN
NOAGGREGATION
NOASYNC
NOBREAKS
NOCHANGEDIR
NOPROGRESS
NOREDIRECTIONBITMAP
@@ -204,6 +208,7 @@ SINGLEUSE
SIZENS
smoothstep
snprintf
SOFTBREAK
spsc
sregex
SRWLOC

View File

@@ -104,6 +104,7 @@
^doc/reference/UTF8-torture-test\.txt$
^doc/reference/windows-terminal-logo\.ans$
^oss/
^NOTICE.md
^samples/PixelShaders/Screenshots/
^src/interactivity/onecore/BgfxEngine\.
^src/renderer/atlas/