extract_toc: fix markdown case when toc not found

The guard is needed to avoid:

  'NoneType' object has no attribute 'extract'

This fixes the bug introduced in the parent commit.
Merge pull request #350 from jedbrown/jed/fix-extract-toc-markdown

extract_toc: fix markdown case when toc not found