assemble / grunt-assemble-toc

Assemble middleware for creating a table of contents in the generated HTML, using Cheerio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exclude headings inside pre, code or iframe tags

jonschlinkert opened this issue · comments

https://github.com/assemble/assemble-contrib-toc/blob/master/index.js#L41

I'm not sure of the best approach or of jquery/cheerio conventions, but maybe something like this will work:

var anchors = $('h1 a[name],h2 a[name],h3 a[name],h4 a[name]');
anchors = $(anchors(':not("pre,code,iframe")'));