mdtoc

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// StartTOC is the opening tag for the table of contents.
	StartTOC = "<!-- toc -->"
	// EndTOC is the tag that marks the end of the TOC.
	EndTOC = "<!-- /toc -->"
	// MaxHeaderDepth is the default maximum header depth for ToC generation.
	MaxHeaderDepth = 6
)

Variables

This section is empty.

Functions

func GenerateTOC

func GenerateTOC(doc []byte, opts Options) (string, error)

GenerateTOC parses a document and returns its TOC.

func GetTOC

func GetTOC(file string, opts Options) (string, error)

GetTOC generates the TOC from a file with options. Returns the generated toc, and any error.

func WriteTOC

func WriteTOC(file string, opts Options) error

WriteTOC writes the TOC generator on file with options. Returns the generated toc, and any error.

Types

type Options

type Options struct {
	Dryrun     bool
	SkipPrefix bool
	Version    bool
	MaxDepth   int
}

Options set for the toc generator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL