Hello,
Thank you for contacting Rank Math today.
We’d recommend using available Table of content plugin instead of having to create your own. There are a good number of ToC plugins you can choose from, here is a list you can refer from.
Hoping this helps you. Thank you.
​​​​​​
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.