# Hide or collapse text in Pluto

**URL:** <https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814>\
**Category:** General Usage\
**Tags:** pluto\
**Created:** [December 30, 2021, 12:21pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814 "2021-12-30T12:21:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 30, 2021, 12:21pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/1 "2021-12-30T12:21:04Z")

</div>

In some cases, it can be useful to hide text (as opposed to markdown) in notebooks when certain details may interrupt the flow of one’s main points. The analog in a static document would be a footnote. Is there a way to hide or collapse text in Pluto so that readers can optionally access certain information if desired?

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 30, 2021, 12:57pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/2 "2021-12-30T12:57:47Z")

</div>

I tried adding html with `@htl`, but it would not respond to a click. Here is the [code](https://gist.github.com/itsdfish/d5a0301af7fdbd50225e0fc4608cc2ea).

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 30, 2021, 1:08pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/3 "2021-12-30T13:08:50Z")

</div>

I think one of the issues is that I need to return something in the `@htl` block, but its not clear to me what should be returned. I tried `coll` and `document` without success.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 30, 2021, 1:44pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/4 "2021-12-30T13:44:00Z")

</div>

I came across `details(md""" """)`. I think this should suffice for my purposes.

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [April 9, 2025, 3:10pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/5 "2025-04-09T15:10:16Z")

</div>

Where did you get the `details` function from?

The [most straightforward solution I’ve found](https://github.com/fonsp/Pluto.jl/issues/297#issuecomment-759639781) would seem to be

```julia
    let
	    content = md"""The above macro generates two functions, one is `f` and another is `~f` (or `Inv(f)`). The `x += y * constant` is translated to function `(x, y, constant) = PlusEq(*)(x, y, constant)`, where the function `PlusEq(*)` is clearly bijective.
    blablabla...
    """
	    HTML("<details><summary><strong>For experts</strong></summary>$(html(content))</details>")
    end

```

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 10, 2025, 12:45pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/6 "2025-04-10T12:45:41Z")

</div>

Thanks for your suggestion. I used PlutoUI. Here is the syntax that currently works:

```julia
begin
	using PlutoUI
	text = md"""
	some text
	"""
	details("Summary", text)
end

```

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [April 10, 2025, 1:27pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/7 "2025-04-10T13:27:32Z")

</div>

That’s what I had assumed. Apparently, for some reason I don’t understand, my notebook ended up with an _ancient_ version of `PlutoUI` that didn’t have that function.

It appears `details` was added in [v0.7.56](https://github.com/JuliaPluto/PlutoUI.jl/releases/tag/v0.7.56) in Feb 2024 (not sure how you already had it in 2021 😉)

It doesn’t help that `details` isn’t mentioned in the [PlutoUI documentation](https://featured.plutojl.org/basic/plutoui.jl)! In any case, it’s working now. Thanks!

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 10, 2025, 1:36pm UTC](https://discourse.julialang.org/t/hide-or-collapse-text-in-pluto/73814/8 "2025-04-10T13:36:01Z")

</div>

That is strange. Maybe `details` was moved from Pluto to PlutoUI. In either case, I am glad it is working!
