Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 2 more nesting levels for toc #1931

Closed
wants to merge 2 commits into from
Closed

Conversation

regevbr
Copy link
Contributor

@regevbr regevbr commented May 24, 2020

fix: #1216
feature request: https://requarks.canny.io/wiki/p/allow-to-select-toc-depth-level (20 votes)

Added 2 more levels of table of contents.
If you think that by default it is too much, please let me know I will add a configuration for it

image

@auto-assign auto-assign bot requested a review from NGPixel May 24, 2020 22:04
@NGPixel
Copy link
Member

NGPixel commented May 24, 2020

This should be configurable in the admin. Not everyone want to see H3 items in the TOC (myself included).

@regevbr
Copy link
Contributor Author

regevbr commented May 24, 2020

Sure will add it soon

@regevbr
Copy link
Contributor Author

regevbr commented May 24, 2020

Added level control - can be between 1-4:
image
@NGPixel can you please CR?

@regevbr
Copy link
Contributor Author

regevbr commented May 31, 2020

@NGPixel did you have a chance to look at this PR?

@regevbr
Copy link
Contributor Author

regevbr commented Jun 23, 2020

@NGPixel can you CR this for the next version?
There are a few up-votes in https://requarks.canny.io/wiki/p/allow-to-select-toc-depth-level

@fireundubh
Copy link

Looking forward to this feature. 👍

@regevbr
Copy link
Contributor Author

regevbr commented Jul 4, 2020

@NGPixel this PR is ready for review as far as I understand

@fireundubh
Copy link

fireundubh commented Jul 5, 2020

I pulled this into a localhost build. Just a couple of UX comments.

Typos

First, there are some minor text issues in the configuration menu:

2020-07-04 20_13_39

  • In Table Of Contents Nesting Level, the Of should be lowercased.
  • In Select the max level ot nesting in page table of contents, the ot should be of.

Documentation

The text could be more clearly written like so (or something like this):

  • Label: Show heading levels up to: or Max Heading Level (because NGPixel seems to prefer title case for labels)
  • Help Message: The table of contents will show headings up to the selected level. By default, only headings up to H2 are shown.

UI

I would change the input box to either a horizontal radial menu or a dropdown menu. As you said in a previous comment, there is a constraint ("can be between 1-4"), so there is no sense in allowing the user to manually enter a value because the possible options are fixed. I also think H1, H2, H3, and H4 would be preferable over 1, 2, 3, and 4.

Horizontal Radio Group

Here's a horizontal radio group:

                  v-radio-group(
                    row
                    outlined
                    prepend-icon='mdi-serial-port'
                    v-model='config.tocLevel'
                    label='Max Heading Level'
                    persistent-hint
                    hint='The table of contents will show headings up to the selected level. By default, only heading levels up to H2 are shown.'
                    )
                    v-radio(
                      label='H1'
                      v-bind:value='1'
                    )
                    v-radio(
                      label='H2'
                      v-bind:value='2'
                    )
                    v-radio(
                      label='H3'
                      v-bind:value='3'
                    )
                    v-radio(
                      label='H4'
                      v-bind:value='4'
                    )

2020-07-04 23_53_11

With a v-spacer (looks a bit cleaner, but a 1/10 spacer would be ideal):

2020-07-05 00_03_39

Support

Finally, to avoid future requests related to supporting more headings, I think you might as well add support for H5 and H6 now.

@fireundubh fireundubh mentioned this pull request Jul 6, 2020
@regevbr
Copy link
Contributor Author

regevbr commented Jul 7, 2020

Thanks @fireundubh will fix it soon

@regevbr
Copy link
Contributor Author

regevbr commented Jul 7, 2020

Thanks @fireundubh for the suggestions. Frontend is not my strong suite so I expected some comments on that side :-)
I applied all your suggestions:

image
image

I want to add a page control level for the toc level as well and will finish it soon

@regevbr
Copy link
Contributor Author

regevbr commented Jul 7, 2020

I also added toc level control per page:

image

@NGPixel can you please CR it. I'm not sure about the migration scripts versioning so please let me know what should I do about it.

@regevbr regevbr force-pushed the toc branch 4 times, most recently from e0404ba to 90b5e2e Compare July 8, 2020 08:09
@regevbr
Copy link
Contributor Author

regevbr commented Jul 8, 2020

I also added the page toc level to the metadata when storing it.
@NGPixel I rebased the branch with the master again as it caused me a few issues.

@regevbr
Copy link
Contributor Author

regevbr commented Jul 12, 2020

I will try to also add to this PR the ability to collapse the toc and make it configurable from what level of toc will it happen.

@regevbr regevbr force-pushed the toc branch 2 times, most recently from a549af8 to 0ac10ec Compare July 12, 2020 22:51
@regevbr
Copy link
Contributor Author

regevbr commented Jul 12, 2020

Just worked a few hours to improve the feature.
I added a collapsing feature. You can control from what header level collapsing will occur.

To sum up the feature:

  1. You can control (globally and per page) the nesting level of the table of contents.
  2. You can control from what level, collapsing will occur (globally and per page) so that up to that level all entries will be shown and to see the rest you will need to click the toc entry.
    Check out the gif below for a quick overview.

@NGPixel and @fireundubh I would love to get any comments on the UI/UX as it is not my strong suite.

toc

@NGPixel
Copy link
Member

NGPixel commented Jul 15, 2020

Change target branch to dev for this PR.

@LucaNerlich
Copy link

LucaNerlich commented Oct 14, 2020

Whats the status on this PR? Id really love to use this feature.

H1 and H2 only for TOC just doesnt cut it for longer pages.

Ah i see, planned for 3.0 #2189

@PD5DJ
Copy link

PD5DJ commented Nov 6, 2021

Is it possible to mannually add this now by ourselves manually?
As we desperate need this at the moment.

@cyr0nk0r
Copy link

cyr0nk0r commented Oct 16, 2023

Is there any chance of this feature getting implemented? It looks like it got pretty far in the design.

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

Successfully merging this pull request may close these issues.

Rendering Core: customise Heading Level depth for Table of Contents
6 participants