Replace Gollum `[[_TOC_]]` tag with result of TableOfContentsFilter
Closes #2494 (closed)
Merge request reports
Activity
4 4 module Pipeline 5 5 class WikiPipeline < FullPipeline 6 6 def self.filters 7 super.insert(1, Filter::GollumTagsFilter) 7 @filters ||= begin 8 filters = super 9 toc = filters.index(Filter::TableOfContentsFilter) 10 filters.insert(toc + 1, Filter::GollumTagsFilter) @DouweM I'm thinking about a future refactoring where we add a
PipelineFilters
class that inherits fromArray
and adds convenience methods likeinsert_before
andinsert_after
.@rspeicher Great idea!
Reassigned to @DouweM
86 86 expect(doc.at_css('a')['href']).to eq 'wiki-slug' 87 87 end 88 88 end 89 90 context 'table of contents' do 91 let(:pipeline) { Banzai::Pipeline[:wiki] } mentioned in commit 3d1de5ba
@DouweM Looking at this again, I'm thinking "Why limit this to Gollum?". Maybe we should update
TableOfContentsFilter
to just do this replacement immediately, and then we get the functionality anywhere we render Markdown.mentioned in merge request gitlab-com/www-gitlab-com!1633 (merged)
@rspeicher Sounds like a plan
and then we get the functionality anywhere we render Markdown.
@rspeicher that would be awesome.
mentioned in merge request !3166 (closed)