JuliaPluto / PlutoSliderServer.jl

Web server to run just the `@bind` parts of a Pluto.jl notebook
https://computationalthinking.mit.edu/
The Unlicense
130 stars 17 forks source link

Don't display hidden cells #123

Open sschmidhuber opened 1 year ago

sschmidhuber commented 1 year ago

Hello, first of all, thank you for this great package.

To use Pluto and PlutoUI beyond the scope of education it would be great to if there is an option not to display hidden cells at all, currently they are shown as white space. Here a random example outlining the issue: grafik

The resulting reports / dashboards would look much better if hidden cells are not displayed at all.

BR Stefan

jevalentini commented 12 months ago

I guess, while there's no solution to this, you can mess with the html with the package HypertextLiteral. After running the cell, you'll need to right click inspect and erase the style tag to have it back to edit it though.

begin
  using HypertextLiteral

  @htl("""
  <script>
   var cell = currentScript.closest("pluto-cell")
   cell.style.display = "none"
  </script>
  """)
end

https://github.com/JuliaPluto/PlutoSliderServer.jl/assets/41552687/2a39a1bf-ea71-493f-bc96-2ff2f63740fb

sschmidhuber commented 12 months ago

Hello @jevalentini , sure as a workaround this would be fine, but I was hoping this could become a default (in case there is no use case for having the white space, maybe I missing something) or get a flag, triggering this behavior, on PlutoSliderServer startup.

However, I understand that's probably not the most urgent issue / feature request 😉

fonsp commented 2 months ago

Hey! Sorry for replying a year late!

Why don't you move the hidden cells to the bottom?

One problem I can see with hiding folded-and-empty cells is that some notebooks use empty cells on purpose, to create spacing between parts of the notebook.

sschmidhuber commented 2 months ago

Hello, yes that is a feasible workaround, which I applied myself as well. However, it makes changes and maintenance much harder, because you need to search the respective cells somewhere at the bottom of your notebook. Also for a non-technical reader of a notebook, it looks quite weird to have so much empty space at the bottom for no obvious reason.

I thought it could be an option to hide the input part of a folded cell, which would also be stored to the notebook. So when it is opened, it opens in "hide folded mode".

Creating vertical space in a notebook, while having "hide folded mode" active could be achieved by something like @htl"<br/><br/>".