Skip to content

jrobertson/yatoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

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

About

Yet Another Table Of Contents HTML generator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages