Project

yatoc

0.0
No commit activity in last 3 years
No release in over 3 years
Yet Another Table Of Contents HTML generator.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.7, >= 0.7.2
~> 0.2, >= 0.2.2
 Project Readme

Introducing the Yatoc gem

require 'yatoc'
require 'kramdown'

s2=<<EOF
# Story 1345

The story of this is not important. Learn more from the text below.

## Foo

This is 1st paragraph

### Train

Work at something

### Travel By Bike

Travel by bike.

## Bar

This is 2nd paragraph

### Mary

Mary had a little lamb

#### Time

Take time to rest

### Weakness

Your weakness is my weakness

--------------
EOF


y = Yatoc.new(Kramdown::Document.new(s2).to_html)
#File.write '/tmp/foo.html', y.to_html
#puts Rexle.new(y.to_toc).xml pretty: true
puts y.to_html

Output

Story 1345

The story of this is not important. Learn more from the text below.

  • 1 Foo
    • 1.1 Train
    • 1.2 Travel By Bike
  • 2 Bar
    • 2.1 Mary
      • 2.1.1 Time
    • 2.2 Weakness

Foo

This is 1st paragraph

Train

Work at something

Travel By Bike

Travel by bike.

Bar

This is 2nd paragraph

Mary

Mary had a little lamb

Time

Take time to rest

Weakness

Your weakness is my weakness


Resources

html toc yatoc gem