Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Add ToC indentation support #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kgryte
Copy link
Member

@kgryte kgryte commented Jul 27, 2020

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 kgryte mentioned this pull request Jul 27, 2020
@ellisonbg
Copy link

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).

@kgryte
Copy link
Member Author

kgryte commented Jul 28, 2020

@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.

@ellisonbg
Copy link

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.

@kgryte
Copy link
Member Author

kgryte commented Jul 28, 2020

@ellisonbg Sounds good! Thanks for your input!

@kgryte kgryte mentioned this pull request Aug 17, 2020
@Stannislav
Copy link

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

@marius311
Copy link
Contributor

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!

@hottwaj
Copy link

hottwaj commented Sep 30, 2020

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 :)

@marthacryan
Copy link
Member

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

@sherdim sherdim mentioned this pull request Dec 17, 2020
@ericdatakelly
Copy link

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

@kgryte
Copy link
Member Author

kgryte commented Jan 26, 2021

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Indentation to toc
7 participants