How to get tablecontent of level as variables use in template?

Hi guys:

There I were added a feature in my theme that can automatic append the numberical number before head title in post body. It was work with the CSS counter-rest function as below example:

.autonumber {
  h2 {
    counter-reset: h3;
    &:before{
      counter-increment: h2; 
      content: counter(h2) ". ";
    }
  }

  h3 {
    counter-reset: h4;
    &:before{
      counter-increment: h3; 
      content: counter(h2) ". " counter(h3) ". ";
    }
  }

  h4 {
    counter-reset: h5;
    &:before{
      counter-increment: h4; 
      content: counter(h2) "." counter(h3) "." counter(h4) ". ";
    }
  }
}

The kind of you see there need know while head title level start and stop, So I want get the level from Hugo configuration file which paramter call tableOfContents settings.

markup:
  tableOfContents:
      startLevel: 2
      endLevel: 4

So what should I need do in CSS file to get those variables?

The TOC configuration is not exposed to the templates.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.