Right now, the process of producing the array of entries containing {list numbering, link id, indentation level, entry content} is split into two functions, get_toc_table_listnum and get_toc_table_prev_indent, and only one of them is called depending on how the table of contents indentation is generated.
This splitting of the process feels pretty arbitrary, especially since get_toc_table_prev_indent is itself divided into two completely independent actions (depending on whether p_br or ul_li is used). If possible, it would make things more maintainable to restructure the code more clearly.
Be sure to update the readme with any changes made here.