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

fixed css & js to allow for nested numbering #53

Merged
merged 1 commit into from Nov 27, 2015

Conversation

Projects
None yet
3 participants
@paulovn
Copy link

paulovn commented Nov 27, 2015

Two small modifications to make nested numbering style work in the ToC (i.e., 1, 1.1, 1.1.1)

  • correct CSS definitions to remove unused nested class
  • fix JS generation of the ToC, ensuring correct placement of each <ol> level (inside the parent <li>, not as a sibling).

Tested on Firefox, Chrome and IE11

minrk added a commit that referenced this pull request Nov 27, 2015

Merge pull request #53 from paulovn/feature/nested-numbering
fixed css & js to allow for nested numbering

@minrk minrk merged commit 210d81f into minrk:master Nov 27, 2015

@jankatins

This comment has been minimized.

Copy link
Contributor

jankatins commented Nov 27, 2015

@paulovn Can you describe the bug which happens here? the toc extension is also included here https://github.com/ipython-contrib/IPython-notebook-extensions/tree/master/nbextensions/usability/toc and I try to see if we need the same fix :-/

@paulovn

This comment has been minimized.

Copy link

paulovn commented Nov 27, 2015

Essentially the original CSS is prepared to number the ToC items with nested numbering, such as

 1 Title
    1.1 Subsection
       1.1.1 subsubsection

it does so by defining counters, and using a custom marker content: counters(item, ".")" ";

But the original code didn't work for me, instead what I got was plain simple independent numbers:

 1 Title
    1 Subsection
       1 subsubsection

which, if you have many levels in the headings of your notebook, is confusing for navigation.

The problem is due to two causes:

  • the CSS <ol> & <li> elements are using the nested class, which the JS code does not set, hence they do not get applied
  • the JS code generates the ToC tree by inserting <ol> elements as a sibling of the <li> element in the upper level they belong to -- I believe this is wrong, they should be inside the <li> element

The fix corrects both facts. If you don't need nested numbering, it probably won't matter much

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