Skip to content

Instantly share code, notes, and snippets.

@stefanwalther
Forked from jonschlinkert/verb-toc.md
Last active August 29, 2015 14:23
Show Gist options
  • Save stefanwalther/a539aa7e2890e93407bd to your computer and use it in GitHub Desktop.
Save stefanwalther/a539aa7e2890e93407bd to your computer and use it in GitHub Desktop.

Easiest Table of Contents possible

In .verb.md where you want to inject the TOC:

<!-- toc -->

Done!

Pro-tip

This is already enabled in Verb, but you can customize with a basic middleware like this:

var toc = require('markdown-toc');

verb.postRender(/\.md$/, return function (file, next) {
  file.content = toc.insert(file.content);
  next();
});

If you want to customize how the TOC renders, just:

  • add a verbfile.js to your project with the code above
  • customize away!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment