If you use the approach recommended here the auto-toc ("Generate Table Of Contents Ctrl+T") function of Sigil will create a toc.ncx out of the following html example but all of your h6.hx tags will only be nested to the 6th level. You would need to manually adjust the nesting (as simple as highlighting and dragging into the previous navpoint). To nest varying levels would only require one to drag the lower-level navpoint inside the previous higher level navpoint.
example html:
The auto toc will detect all the hx tags up to level h6 as shown in the 1st attached image:
auto created .ncx:
The auto created .ncx will appear as shown in the 2nd attached image.
manually corrected .ncx:
The manually corrected .ncx will appear as shown in the 3rd attached image. (note: this is how it appears in Sigil - no guarantee how other devices/apps will display it)
Once the .ncx is manually corrected then you could use the "Create HTML Table Of Contents" tool from Sigil and it will create a correctly organized/tagged html file.
auto generated HTML-TOC:
You would then need to manually change the additional levels to indent/format them further by adjusting the css file created for the html toc.("sgc-toc.css")
example sgc-toc.css:
Of course, you would also have to style/format these classes in your regular css sheet so that they display properly within your document.
sample css:
Cheers,