function split(str, re) {
  return str.split(re).map(trim);
}
The basic idea:

 1. when front-matter exists, we need to avoid turning its properties into headings.
 2. We need to detect toc markers on the page. For now it's a simple HTML code comment
    to ensure the markdown is compatible with any parser.

@param  {String} `str` Pass a string of markdown
@param  {Object} `options` Pass options to toc generation
@return {String} Get the same string back with a TOC inserted