Module: Jekyll::TableOfContents::Helper
- Included in:
- Parser
- Defined in:
- lib/table_of_contents/helper.rb
Overview
helper methods for Parser
Constant Summary collapse
- PUNCTUATION_REGEXP =
/[^\p{Word}\- ]/u.freeze
Instance Method Summary collapse
Instance Method Details
#generate_toc_id(text) ⇒ Object
9 10 11 12 13 14 |
# 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 |