Extract the heading outline from Markdown — depth, text and a unique GitHub-style anchor slug for each heading. Optionally limit to a maximum heading depth.