TOC on Source theme

Hi again @elena018 ,

I returned with updated version 2.1 of my script

You need to copy it from here: github gist
Or from my article: link

Here is example of usage:

<toc title="Table of Contents"
  collapsible="true" 
  show-text="Open" 
  hide-text="Close"
  border-color="#000"
  bg-color="ivory"
></toc>

Now it has more parameters in addition to title:

  • (optional) collapsible - adds a show/hide button, border, background and some paddings
  • (optional) show-text & hide-text - allow you to override button name in case where you need it or for other languages
  • (optional) border-color & bg-color - allow you to control the styles. Can accept either color name (like ivory) or hash (like #000 for black)

As minimum you’ll need collapsible="true". As you see all the rest parameters are optional. I use Show/Hide by default as a button name, gainsboro as border color and aliceblue as background color

As example of work I updated one of my articles: 4G LTE USB Wi-Fi Modem Review from AliExpress

So, you can start from this:

<toc title="Table of Contents" collapsible="true"></toc>

I hope this version works as you expected

1 Like