I am not sure if this is a bug or it is expected. When I have this example:
= Test Document
:toc:
:toclevels: 5
:sectnums:
:sectnumlevels: 5
== Level 1
=== Level 2
==== Level 3
===== Level 4
====== Level 5
The headers for the Levels are correctly displayed. However, in the table of contents the section numbers are only displayed up to level 3. See the attached image.

This can happen if the sectnumlevels is defined after the document header.
= Document Title
:toc:
:toclevels: 5
:sectnums:
:sectnumlevels: 5 <- not in the document header
Are you sure it's exactly how you wrote it and that nothing is overriding the sectnumlevels? How are you invoking Asciidoctor? Are you passing options to it?
Yes, that is exactly how I wrote it. I have :toc!: outside of the header, due to the table of contents appearing in some tables. And after that I have the sectnumlevels and some other parameters. When it is in the header it works, I was not aware about the header.
I am invoking Asciidoctor via the maven plugin in java. The passed options do not have anything related to the toc and sections
Thanks for the help
You can now upgrade to Asciidoctor 1.5.4 and the toc in table cell problem is gone. Then, make sure you define document-oriented attributes in the header and you should be good to go.
All the problems reported in this issue should now be resolved. I invite you to file a new issue if you run into other problems.
Thanks. I am not on that project anymore, but will give it a try in another one. If there as any issues, I'll open a new one.
Great!
Most helpful comment
This can happen if the sectnumlevels is defined after the document header.
Are you sure it's exactly how you wrote it and that nothing is overriding the sectnumlevels? How are you invoking Asciidoctor? Are you passing options to it?