added missing code from gist; toc need at least 3 elements to be generated