Skip to content

Automatically create id for sub toc item #70

@samnung

Description

@samnung

Add API for creating sub items for TOC + public API for creating ID from TOC title.

Bookspec for example:

Epuber::Book.new do |book|
  book.toc do
    toc.file 'text/intro', 'Intro' do
      toc.item 'Section'
    end
  end
end

It will create following items in toc:

<ol>
  <li><a href="text/intro.xhtml">Intro</a>
    <ol>
        <li><a href="text/intro.xhtml#section">Section</a>
    </ol>
  </li>
</ol>

Hash section will be generated from title. Example in Bade:

mixin section(title)
  h2.section(id: __helpers.id_for_title(title))= title

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions