dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.91k stars 389 forks source link

text/markdown mime type no supported as output #1983

Open mika76 opened 2 years ago

mika76 commented 2 years ago

Is your feature request related to a problem? Please describe. If I had to write display("# something", "text/markdown") it comes back with an error that text/markdown mimetype is not supported

Describe the solution you'd like It would be nice to show markdown like you show html

Describe alternatives you've considered Other than displaying as plain text or html I don't know of any work around

jonsequitur commented 2 years ago

You can use the DisplayAs extension method:

image

The DisplayAs() method (which extends string) displays the existing string, unchanged, using the specified MIME type.

The Display() extension method (and the older, more Pythonesque display() method) generate a string from objects of any type and then DisplayAs() the specified MIME type.

So you can think of this...

image

As essentially combining these two steps:

image

(The reason the last one renders as a table is because HTML is valid within Markdown, but notice the difference between how VS Code renders the HTML versus the HTML-within-Markdown.)