The module is stripping out headings that have tags inside due to a greedy regex.
For example:

<h2><li>one</li></h2>

Would show up empty in the TOC.

Starting at line 135:

      preg_match_all('/<h([' .
        $toc_options["minlevel"] . '-' .
        $toc_options["maxlevel"] . '])( .*(id="([^"]+)" ?.*))?>(.*)<\/h([' .
        $toc_options["minlevel"] . '-' .
        $toc_options["maxlevel"] . '])>/i', $text, $matches, PREG_PATTERN_ORDER);

The second .* needs to be non-greedy:

        $toc_options["maxlevel"] . '])( .*(id="([^"]+)" ?.*?))?>(.*)<\/h([' .

This is my first submission to drupal, I hope this is the right place for it.

Comments

deviantintegral’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
Assigned: Unassigned » deviantintegral
Status: Needs review » Fixed

Hi, sorry for the delay on this.

Your code (or something very similar) has been implemented in the 2.x version. Please give it a try and let me know how it works!

Thanks,
--Andrew

deviantintegral’s picture

Status: Fixed » Closed (fixed)