PlutoExtras.jl

Random Pluto Utilities
Author disberd
Popularity
15 Stars
Updated Last
1 Year Ago
Started In
June 2021

PlutoExtras

This package provides some widgets to be used in Pluto, including an extended version of the TableOfContents from PlutoUI and a new experimental bond container (BondTable).

This was formerly a non-registered package named PlutoUtils

BondTable (NEW!)

There is some new under-development experimental feature to simplify the grouping and displaying of many bonds within a given notebook in a floating table (similar to the TableOfContents) that stays on the left and can be hidden, resized and moved around.

Have a look at the notebook at notebooks/test_bondstable.jl for an example of the features/capabilities. (The link points to a static html export of the notebook. If you want to execute the notebook, remember that it has to be executed from the cloned repository as it currently uses the package environment of the package)

ExtendedTableOfContents

The extended_toc.jl notebook defines and exports ExtendedTableOfContents, which takes the TableOfContents from PlutoUI and adds the following functionalities:

Hiding Heading/Cells

Hiding headings and all connected cells from notebook view can be done via ExtendedTableOfContents

  • All cells before the first heading are automatically hidden from the notebook
  • All hidden cells/headings can be shown by pressing the eye button that appears while hovering on the ToC title.
    • When the hidden cells are being shown, the hidden headings in the ToC are underlined
  • Hidden status of specific headings in the notebook can be toggled by pressing on the eye button that appears to the left each heading when hovering over them

Collapsing Headings in ToC

ToC headings are grouped based on heading level, sub-headings at various levels can be collapsed by using the caret symbol that appears to the left of headings in the ToC upon hover.

Scroll behavior fix

The weird scrolling issue appearing on chromium-based browsers with the scrolling in the TableOfContents (see JuliaPluto/PlutoUI.jl#238) is fixed by relying on the SmoothScroll library.

  • SmoothScroll is used by default to replace the scroll upon heading click behavior. To maintain the original behavior, call ExtendedTableOfContents(;use_smoothscroll = false)

Save Hide/Collapsed status on notebook file

Preserving the status of collapsed/hidden heading is supported by writing to the notebook file using notebook and cell metadata, allowing to maintain the status even upon reload of Julia/Pluto

  • When the current collapsed/hidden status of each heading is not reflected in the notebook file, a save icon/button appears on the left of the ToC title upon hover. Clicking the icon saves the current state in the notebook file.

Changing Headings/Cells order

The ExtendedTableOfContents allow to re-order the cell groups identified by each heading within the notebook:

  • Each cell group is identified by the cell containing the heading, plus all the cells below it and up to the next heading (excluded)
  • Holding the mouse on a ToC heading triggers the ability to move headings around
    • The target heading is surrounded by a dashed border
    • While moving the mouse within the ToC, a visual separator appears to indicate the position where the dragged heading will be moved to, depending on the mouse position
    • Hovering on collapsed headings for at least 300ms opens them up to allow moving headings within collapsed parents
  • By default, headings can only be moved below or above headings of equal or lower level (H1 < H2 < H3...)
    • Holding shift during the dragging process allows to put headings before/after any other heading regardless of the level

Example usage

State Manipulation

State_Manipulation

Cell Reordering

Cell_Reordering

Used By Packages

No packages found.