Fix ToC breaking documents with empty h* elements
Fix ToC breaking documents with empty h* elements

Right now, the ToC has an undefined variable i that was an index in the
original ToC code. Since the major rewrite in
4fe062085324c50f2cfa062258559cf31858ef5f it's a recursive function
without this index. The variable `i` was wrongly copied into its current
place from the old code.

This patch replaces the variable `i` with the index of the header
element. Fix the undefined variable problem.

Signed-off-by: Sheogorath <1c2647ce2ee8a4ec8e5c8b1b245ca38f94844bab@shivering-isles.com>

Yukaii/hackmd,Yukaii/hackmd,hackmdio/hackmd,jackycute/HackMD,hackmdio/hackmd,hackmdio/hackmd,Yukaii/hackmd,jackycute/HackMD,jackycute/HackMD