When you parse multiple documents with the same renderer instance,
toc_data.level_offset is only set at the first document, because
toc_data.header_count is only 0 once, at the first document.
To fix this if (options->toc_data.header_count == 0) must be changed to
if (options->toc_data.current_level == 0), because toc_data.current_level
is 0 at the start of each document. And toc_data.level_offset will be
set to the right offset at each document.
Fixes a bug in my previous pull request that is already closed.
When you parse multiple documents with the same renderer instance,
toc_data.level_offset
is only set at the first document, becausetoc_data.header_count
is only0
once, at the first document.To fix this
if (options->toc_data.header_count == 0)
must be changed toif (options->toc_data.current_level == 0)
, becausetoc_data.current_level
is0
at the start of each document. Andtoc_data.level_offset
will be set to the right offset at each document.Fixes a bug in my previous pull request that is already closed.