# How to print markdown in the terminal

**URL:** https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397
**Category:** General Usage
**Tags:** question
**Created:** [June 8, 2022, 1:36am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397 "2022-06-08T01:36:48Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 8, 2022, 1:36am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/1 "2022-06-08T01:36:48Z")

</div>

I want to print styled markdown with colors and etc (the same way the REPL prints docs), instead of the raw text. So far i wasn’t able to figure out, i was thinking something like:

```julia
show(stdout, MIME"text/markdown", some_markdown)

```

But the above does not work.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [June 8, 2022, 2:27am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/2 "2022-06-08T02:27:19Z")

</div>

@dylanxyz - the most advanced rendering I have seen in the Julia REPL comes from [Home · Term.jl](https://fedeclaudi.github.io/Term.jl/stable/) - I don’t know of anything that prints styled markdown-like text in the REPL, but I think this tool is probably the best shot to do something like what you imagine.

P.S. @FedeClaudi is the author and is super active about the project!  
CC’ing him to see this.

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 8, 2022, 2:42am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/3 "2022-06-08T02:42:33Z")

</div>

`Term.jl` is a awesome package, however i could not find markdown related stuff when searching through the docs.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [June 8, 2022, 5:48am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/4 "2022-06-08T05:48:34Z")

</div>

This will show up as styled Markdown text in the terminal (or in Jupyter, Pluto, etc.)

```nohighlight
julia> using Markdown

julia> md"Some **bold** text"
  Some bold text

julia> Markdown.parse("Some **bold** text.")
  Some bold text.

```

That being said, it would be nice to support `display("text/markdown", "Some **bold** text")` in the REPL (this is already supported in e.g. Jupyter/IJulia).

---

<div class="post-metadata">

### Author: ![FedeClaudi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedeclaudi/32/33490_2.png) [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)
#### Post date: [June 8, 2022, 8:20am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/5 "2022-06-08T08:20:05Z")

</div>

Hey, the developer of Term here (thanks for the shotout @TheCedarPrince)

@dylanxyz that’s right, Term doesn’t currently support Markdown, but it should be a nice and easy feature to add. Python’s rich libray [has it](https://github.com/Textualize/rich/blob/master/rich/markdown.py), all you need is to parse the markdown text into tokens (header, bullet point list…) and then use those to crate a styled text using Term’s markup syntax. Julia has [markdown parsing](https://github.com/JuliaLang/julia/blob/master/stdlib/Markdown/src/parse/parse.jl#L79) so it should be pretty easy.

I’d be happy to work on it together if you want to help implement this, otherwise I will add it to the things to add to Term (finishing a coupe other features first)

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 8, 2022, 4:09pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/6 "2022-06-08T16:09:15Z")

</div>

This is what i want, but how to make this work outside the REPL?

```bash
> julia -e 'using Markdown; md"`Hello` *world*" |> println'
`Hello` *world*

```

As you can see, only the raw text is printed.

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 8, 2022, 4:11pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/7 "2022-06-08T16:11:16Z")

</div>

This would be a awesome feature to support!

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [June 8, 2022, 5:49pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/8 "2022-06-08T17:49:14Z")

</div>

> [@dylanxyz](#):
>
> This is what i want, but how to make this work outside the REPL?

```julia
julia -e 'using Markdown; md"`Hello` *world*" |> display'

```

(`print` by definition only writes the plain text `show` output.)

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 8, 2022, 6:10pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/9 "2022-06-08T18:10:19Z")

</div>

Thank you! I was unaware of the `display` function.

---

<div class="post-metadata">

### Author: ![FedeClaudi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedeclaudi/32/33490_2.png) [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)
#### Post date: [June 8, 2022, 10:50pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/10 "2022-06-08T22:50:51Z")

</div>

Term.jl will have a markdown parser in the next version: [Term.jl/markdown.jl at v4 · FedeClaudi/Term.jl · GitHub](https://github.com/FedeClaudi/Term.jl/blob/v4/src/markdown.jl)

stay tuned!

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 9, 2022, 1:08am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/11 "2022-06-09T01:08:15Z")

</div>

@FedeClaudi For now the `display` function works for me, but i’ll definitely use the `Term.jl` version once is ready 😄.

---

<div class="post-metadata">

### Author: ![FedeClaudi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedeclaudi/32/33490_2.png) [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)
#### Post date: [June 10, 2022, 9:59am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/12 "2022-06-10T09:59:29Z")

</div>

No problem, this is what it’s going to look like though 😃 [https://twitter.com/Federico\_claudi/status/1535034402018934784?s=20&t=ZUI796ZIWamwS-ZDeL8A5w](https://twitter.com/Federico_claudi/status/1535034402018934784?s=20&t=ZUI796ZIWamwS-ZDeL8A5w)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/c/0cbab379f21d41f115e69d82f4d5899220ec09f9.jpeg)  
Uploading: image.png(1)…

I can give you a shout once it comes out if you’d like.

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 10, 2022, 12:17pm UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/13 "2022-06-10T12:17:57Z")

</div>

Awesome! I would appreciate 🙏.

---

<div class="post-metadata">

### Author: ![FedeClaudi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fedeclaudi/32/33490_2.png) [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)
#### Post date: [June 20, 2022, 10:06am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/14 "2022-06-20T10:06:34Z")

</div>

Term.jl v1.0 is out with new Markdown parsing functionality: [Markdown · Term.jl](https://fedeclaudi.github.io/Term.jl/stable/adv/markdown/)

---

<div class="post-metadata">

### Author: ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)
#### Post date: [June 20, 2022, 11:24am UTC](https://discourse.julialang.org/t/how-to-print-markdown-in-the-terminal/82397/15 "2022-06-20T11:24:50Z")

</div>

That’s so cool, thanks for your work 🙏!
