Turns out the solution can be generalized to convert any HTML with a nested list (<ul> or <ol>) TOC to a JS Tree widget...which makes me think there's a CPAN module that already does this, but I haven't found the search terms to locate it.
(As an example of the different output, see this old page vs. the converted page.)
Update
Done. See HTML::ListToTree.
In reply to Convert nested list HTML TOC to JS Tree ? by renodino
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |