jupyterlab-toc icon indicating copy to clipboard operation
jupyterlab-toc copied to clipboard

Add ToC indentation support

Open kgryte opened this issue 4 years ago • 10 comments

This PR resolves #114 by

  • adding indentation to ToC entries

Notes

  • This PR does not currently indent either code or Markdown entries for reasons of preserving full width rendering. If we indent code or Markdown, this could make the content illegible for small widths.

Screenshots

Collapsing enabled

Screen Shot 2020-07-27 at 12 51 36 AM

Collapsing enabled + numbering enabled

Screen Shot 2020-07-27 at 12 51 51 AM

Collapsing enabled + numbering enabled + code + Markdown

Screen Shot 2020-07-27 at 12 58 31 AM

Collapsing disabled

Screen Shot 2020-07-27 at 1 02 28 AM

Collapasing disabled + numbering enabled

Screen Shot 2020-07-27 at 12 56 53 AM

Collapsing disabled + numbering enabled + code + Markdown

Screen Shot 2020-07-27 at 12 57 26 AM

kgryte avatar Jul 27 '20 08:07 kgryte

Something to think about from a visual design perspective is the a trees with indentation in a narrow panel start to be difficult at a certain depth. I think the proposed design here is making a good set of tradeoffs overall (reducing font size and lower depths, intending with a small amount of horizontal space).

ellisonbg avatar Jul 28 '20 18:07 ellisonbg

@ellisonbg Thanks for taking a look. Instead of making this the default behavior, we could add an extension setting to allow users to toggle ToC indentation. Lack of ToC indentation has been a recurring request both on this repo, as well as internally. So offering the ability for users to opt-in to indentation seems like a reasonable compromise.

kgryte avatar Jul 28 '20 18:07 kgryte

I agree it is useful and don't know it needs to be a setting (not opposed to it though). I do think it is a good default behavior as well. I was more encourage us to keep thinking about the tradeoffs and how we might make subtle visual changes to improve the overall experience while using indentation. I don't have specific recommendations, more of a general, let's keep exploring this as people start to use it.

ellisonbg avatar Jul 28 '20 18:07 ellisonbg

@ellisonbg Sounds good! Thanks for your input!

kgryte avatar Jul 28 '20 18:07 kgryte

Would it be possible to reduce the space between the lines in the TOC? I find the Jupyter TOC(2) extension is doing a good job on both horizontal and vertical spacing:

Screenshot 2020-08-22 at 14 15 41

source

Stannislav avatar Aug 22 '20 13:08 Stannislav

Just my 2c, but from a visual design perspective, I find the the diffrent font sizes of the different ToC levels extremely disorienting, especially coupled with same-sized collapse arrows. My guess is their original purpose was because we didn't have indentation, so something needed to indicate depth, but if we have indentation, maybe the font sizes can be made uniform, at least when code/markdown is off, when the disorientation is particularly bad? (just look how much better that TOC2 screenshot looks, at least to me)

Even if not, happy to see this PR, thank you!

marius311 avatar Aug 23 '20 01:08 marius311

Could you add in a little extra to cover indentation for toc of .py files?

See lines 17-22 here: https://github.com/hottwaj/jupyterlab-toc/blob/toc-indentation/src/generators/python/render.tsx

I guess something similar may also be needed for markdown & latex...

Thanks for this PR :)

hottwaj avatar Sep 30 '20 20:09 hottwaj

jupyterlab/jupyterlab#9275 addresses this in the core extension. Maybe we should close this PR?

marthacryan avatar Nov 20 '20 17:11 marthacryan

@kgryte I think you agree to close this PR, correct?

ericdatakelly avatar Jan 26 '21 15:01 ericdatakelly

@ericdatakelly Depends on if people want/need this in a JLab version prior to ToC being merged into core. I don't necessarily see any harm in keeping the PR open indefinitely.

kgryte avatar Jan 26 '21 18:01 kgryte