Skip to content

This goldmark parser extension adds support for generating table of content

License

Notifications You must be signed in to change notification settings

mdigger/goldmark-toc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goldmark-toc

GoDoc

Goldmark extension for generating table of content.

var source = []byte(`
# Title
paragraph text
## Section *1*
paragraph text
### Subsection *1.1*
paragraph text
## Section *2*
paragraph text
## Заголовок на русском
`)
info, err := toc.Convert(source, ioutil.Discard)
if err != nil {
	log.Fatal(err)
}
for _, header := range info.Headers {
	fmt.Printf("%+v\n", header)
}
{Level:1 Text:Title ID:title}
{Level:2 Text:Section 1 ID:section-1}
{Level:3 Text:Subsection 1.1 ID:subsection-1-1}
{Level:2 Text:Section 2 ID:section-2}
{Level:2 Text:Заголовок на русском ID:zagolovok-na-russkom}

About

This goldmark parser extension adds support for generating table of content

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages