Categorygithub.com/mdigger/goldmark-toc
modulepackage
0.0.0-20191225162753-7bc0e0d778c3
Repository: https://github.com/mdigger/goldmark-toc.git
Documentation: pkg.go.dev

# README

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}

# Functions

Convert from markdown to html with default options and return TOC.
Headers return table of content from parsed markdown document.
Markdown extends initialied goldmark.Markdown and return converter function.
New return markdown converter with table of content support.
NewIDs return initialized ID generator for goldmark parser context.
WithIDs return new initializer parser option with ID generator.

# Variables

Lang define the default language for generating slug id fo headers.

# Structs

Header holds the data about a header.

# Type aliases

ConverterFunc is markdown converting function.