diff --git a/README.md b/README.md index 15da957c..de105854 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ gem 'rouge' * `PlainTextInputFilter` - `escape_utils` * `SanitizationFilter` - `sanitize` * `SyntaxHighlightFilter` - `rouge` +* `TableOfContentsFilter` - `escape_utils` * `TextileFilter` - `RedCloth` _Note:_ See [Gemfile](/Gemfile) `:test` block for version requirements. diff --git a/lib/html/pipeline/toc_filter.rb b/lib/html/pipeline/toc_filter.rb index 4b15e252..56b72cdd 100644 --- a/lib/html/pipeline/toc_filter.rb +++ b/lib/html/pipeline/toc_filter.rb @@ -1,3 +1,5 @@ +HTML::Pipeline.require_dependency('escape_utils', 'TableOfContentsFilter') + module HTML class Pipeline # HTML filter that adds an 'id' attribute to all headers @@ -43,7 +45,7 @@ def call uniq = headers[id] > 0 ? "-#{headers[id]}" : '' headers[id] += 1 if header_content = node.children.first - result[:toc] << %(