generate

Generates a table of contents from a flat sequence of headings, based on their depth.

Example:

H1 ABC
H2 DEF
H2 GHI
H3 JKL
H2 MNO
H1 PQR

Should generate:

- ABC
- DEF
- GHI
- JKL
- MNO
- PQR

Return

the generated table of contents

Parameters

headings

flat sequence of headings