RubyGems Navigation menu

html_toc 1.1.0

This gem is intended to be used in Rails pre-processing, after the page has been generated but before it is delivered to the requestor. It does a case-insensitive search in the source text for [[toc]], which marks where the table of contents will be placed. If the token is not found, the unmodified source is returned. If the token is found, it searches the text for header tags in a given range, and add an id attribute if the header does not already have one. If no headers were found, it will remove the token and return the modified source. If there are headers, a link is generated for each one, using the header's text and id for the link's text and href. The links are wrapped in some divs, with classes and ids added so the table of contents can be styled. The token is then replaced with the table of contents, and the the modified source is returned.

Gemfile:
= Copy to clipboard Copied!

install:
=

Versions:

  1. 1.2.0 - December 28, 2014 (8 KB)
  2. 1.1.0 - December 13, 2014 (8 KB)
  3. 1.0.2 - December 10, 2014 (6 KB)
  4. 1.0.1 - December 10, 2014 (6 KB)
  5. 1.0.0 - December 10, 2014 (6 KB)

Owners:

Authors:

  • Gregory Gadow

SHA 256 checksum:

60fd51d281718ff9750146a6a63c82d78cc8ed5548abf0fef562bc0c538699c4

Total downloads 12,740

For this version 2,360

License:

MIT

Required Ruby Version: >= 2.1

Links: