dafi / tocmd-generator

Table of Contents Generator for Markdown pages
MIT License
65 stars 11 forks source link

Support ToC Deeper than h2? #6

Open ickc opened 8 years ago

ickc commented 8 years ago

Hi, sorry to bother you again. Would you consider to add support for heading deeper than h2? e.g. like in LaTeX one can use \setcounter{tocdepth} to set the depth of the ToC up to the specified level. So, say, we can use an optional parameter ToCDepth which is defaulted to 2 but can be set from 1-6.

dafi commented 8 years ago

Hi, don't worry you don't bother me. At this time I'm a bit budy but adding a deeper heading is under my radar

ickc commented 8 years ago

Thanks. Meanwhile I wrote a css so that in the body section the heading will be numbered in the way it did in the ToC:

/* reference from http://philarcher.org/diary/2013/headingnumbers/ */

body {counter-reset: h1}
h1 {counter-reset: h2}
h2 {counter-reset: h3}
h3 {counter-reset: h4}
h4 {counter-reset: h5}
h5 {counter-reset: h6}
.post-content{
    h1:before {counter-increment: h1; content: counter(h1) ". "}
    h2:before {counter-increment: h2; content: counter(h1) "." counter(h2) ". "}
    h3:before {counter-increment: h3; content: counter(h1) "." counter(h2) "." counter(h3) ". "}
    h4:before {counter-increment: h4; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "}
    h5:before {counter-increment: h5; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
    h6:before {counter-increment: h6; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "}

    h1.nocount:before, h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before { content: ""; counter-increment: none }
}

In my case, I want it in my post-content class. Do you think this css should be added to tocmd-generator as an optional css for the body too?