module Jekyll::TableOfContents::Helper

helper methods for Parser

Constants

PUNCTUATION_REGEXP

Public Instance Methods

generate_toc_id(text) click to toggle source
# File lib/table_of_contents/helper.rb, line 9
def generate_toc_id(text)
  text = text.downcase
             .gsub(PUNCTUATION_REGEXP, '') # remove punctuation
             .tr(' ', '-') # replace spaces with dash
  CGI.escape(text)
end