In Python it seems to be easy to output markdown in a jupyter notebook, see
I have not found a way to do this in Julia. How can I do this in Julia?
Markdown.MD displays as
text/markdown. For example
some + code
The easiest way is to use
display("text/markdown", "...some markdown text..."). For example:
As is explained in the documentation for
display, by passing a MIME type as the first argument you can supply the “raw” data in any given MIME type. (e.g. you can supply a string of
text/latex, a byte array of
image/png data, and so on.)
The advantages of creating a
Markdown.MD object, as suggested by @fredrikekre, are that (1) you can return this object so that it can be displayed in a context determined by the caller (e.g. for use by Interact.jl) and (2) it can display in contexts that don’t support markdown (e.g. it can display as plain text in the REPL, or as text/html in contexts that support this). The disadvantage is that it requires a bit more typing and is marginally slower (since it requires Julia to parse the markdown text instead of sending it as-is to Jupyter).
Thank you, this was exactly what I was looking for!
Follow up question: How can I use produce latex display math in jupyter?
If I evaluate the cell shown below it prints dollars symbols before and after the equation.
s = raw"
Below is an image of what “native” markdown in jupyter looks like and what Julia markdown looks like.
This is at least an option:
s = raw"