# Markdown cells in Pluto

**URL:** <https://discourse.julialang.org/t/markdown-cells-in-pluto/60948>\
**Category:** Pluto\
**Tags:** markdown\
**Created:** [May 11, 2021, 1:00pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948 "2021-05-11T13:00:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [May 11, 2021, 1:00pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/1 "2021-05-11T13:00:34Z")

</div>

Hello! I think this could be a nice feature: be able to make some cells md cells.

The idea is the following:

1. Click to button next to the “fold” button
2. Then the code is wrapped by `md"""<your code>"""`, as with `Ctrl-M`.

![image](https://global.discourse-cdn.com/julialang/original/3X/1/0/10943cf951784bc4790225a47a47f9256a3c0b56.png)

- Extra feature: hide `md"""` and `"""` from the code and highlight as markdown. This could apply for `Ctrl-M` too.

UPDATE: I’m at this point [https://github.com/i-apellaniz/Pluto.jl/tree/markdown-toggle](https://github.com/i-apellaniz/Pluto.jl/tree/markdown-toggle) at the moment.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 11, 2021, 3:00pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/2 "2021-05-11T15:00:38Z")

</div>

Hi,

Pluto cells are always Julia code, hiding the `md"""` parts would break with this design principle.  
If adding a button for markdown (as an alternative to Ctrl-M) is beneficial is a matter of taste. I suggest to file an Issue at [https://github.com/fonsp/Pluto.jl](https://github.com/fonsp/Pluto.jl) first in order to discuss it.

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [May 11, 2021, 3:14pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/3 "2021-05-11T15:14:36Z")

</div>

Yes! I also like that the code is saved as Julia code. Since you can send the file to someone else and somehow he/she can run it. But things can be more user friendly, and markdown is everywhere in a Pluto notebook. I have made some more progress on this and now one can toggle code/markdown.

I post it on discourse since I thought that it’s a better place to discuss such a thing. Let me know please why you think it is better to post on GitHub

![Sin nombre](https://global.discourse-cdn.com/julialang/original/3X/d/a/da730eb8afd8c3e95097633b20616c1f9f6be593.png)

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 11, 2021, 3:16pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/4 "2021-05-11T15:16:09Z")

</div>

cc @fonsp

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [May 11, 2021, 3:41pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/5 "2021-05-11T15:41:37Z")

</div>

As a user, I want to give a huge thumbs up to this. It looks fantastic (pretty), and I have missed this feature a lot. I thought about suggesting this myself at some point, so kudos to you for making it happen!

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [May 11, 2021, 3:54pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/6 "2021-05-11T15:54:20Z")

</div>

I would add the I think that markdown cells should hide the code by default after being excuted.

---

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [May 16, 2021, 11:05pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/7 "2021-05-16T23:05:13Z")

</div>

Very cool! We are adding a context menu to cells, maybe this could go there! bit of info here [Temporary Execution barrier by lungben · Pull Request #985 · fonsp/Pluto.jl · GitHub](https://github.com/fonsp/Pluto.jl/pull/985)

As for hiding the `md"""` and syntax-highlighting markdown, that would be fantastic! I would add markdown keyboard shortcuts and maybe buttons for **B** and _I_ and such. On the other hand, one nice thing about showing the `md"""` is that it might show people that they interpolate with `$` and that they can use it like other Julia objects, e.g. `intro = md"Hello!"`

My goal for this is a more general concept of _inline GUI editors_ for common syntax patterns: [Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.](https://www.notion.so/malyvsen/bind-level-2-e7559cc9b0ed43f4b0c178285f8ae352)

---

<div class="post-metadata">

**Author:** ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)\
**Post date:** [May 17, 2021, 7:14pm UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/8 "2021-05-17T19:14:43Z")

</div>

It looks like observablehq recently implemented this feature. A very emotional response expressing similar concerns: [JavaScript, Markdown, HTML, and TeX Cell Modes. OH MY! - #4 by jwoLondon - Announcements - The Observable Forum](https://talk.observablehq.com/t/javascript-markdown-html-and-tex-cell-modes-oh-my/5057/4)

---

<div class="post-metadata">

**Author:** ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Post date:** [May 18, 2021, 6:58am UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/9 "2021-05-18T06:58:10Z")

</div>

I wanted to highlight some of the content in the discussion @fonsp linked to:

> Confrontation anxiety / low work self-esteem friendly summary 😊:
> 
> The gains don’t out-weight the losses.
> 
> - Template literals are very modular and compose nicely. Typed cells don’t.
> - Template literals empower the community and promote experimentation and collaboration.
> - Having to write `~~~` instead of ``` is a non issue.
> - Additional keyboard shortcuts and mouse operations introduce friction.
> - They don’t play nicely with copy and paste.
> - More UI means less interoperability.
> - This adds more maintenance burden on an obviously overworked team.
> 
> Thanks for trying tho 🥰!

There is a “Frustration fuelled rant 😉 :” after this, saying among other things that

> I’ve used other notebooks with typed cells like nextjournal 1 and starboard 2, typed cells plain suck.

Even though I would love prettier markdown cells, and fully agree that it should be a priority due to a large proportion of Pluto-cells being markdown, I really feel like there are some good points raised in the Observable discussion. So I would like to propose an idèa I just had, that I feel has the potential to strike a good middle ground:

## The suggestion:

There is a toggle to markdown-format a cell. But this toggle simply adds `md"""` as the first line and `"""` as the last line, and makes the first and last lines _ **low constrast** _. This has the effect of mostly hiding it to the user, without actually changing any of the code in the cell, which should result in none of the typical downsides of typed cells! By having a “markdown-mode”, one could also activate propper highlighting as opposed to the uniform brown. Toggling markdown-mode off would simply delete the first and last line, and change the highlighting.

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [May 19, 2021, 1:09am UTC](https://discourse.julialang.org/t/markdown-cells-in-pluto/60948/10 "2021-05-19T01:09:25Z")

</div>

Thank you for the responses! What @TheLateKronos says is 100% reasonable. We can call them cell “views”, instead of cell “modes”, since the underlaying code with either approach is always valid Julia code.

I think the main motivation to do this kind of changes is to engage new people, or people with bad memory and a bit lazy as me 😄 ! I would like the highlight for markdown, and the shortcut to toggle it was a nice discovery!

On this line, I think markdown editing should be doable at some point from the output instead of the cell itself. One could start a new cell, toggle it to markdown view (which could fold the code by default), and start the cursor in the output of the cell. On that context there could be some buttons and shortcuts in a similar way as for "inline GUI"s, as @fonsp has shown. Reaaally nice feature!!

FTR: `contentEditable: true` when toggling to markdown-view 🥳
