md

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ParseMD model.ParseFunc = func(c *config.Config, in io.ReadCloser) *model.Result {

	if c.Verbose {
		fmt.Println("--> parsing Markdown...")
	}

	defer in.Close()
	contents := parseMD(in)

	if c.Verbose {
		fmt.Println("--> parsed")
		fmt.Printf("%s\n", contents)
	}

	if c.TagWeights == nil {
		c.TagWeights = defaultTagWeights
	}
	if c.ExtraTagWeights != nil {
		for k, v := range c.ExtraTagWeights {
			c.TagWeights[k] = v
		}
	}

	tags, title, lang := tagifyMD(contents, c)

	return &model.Result{
		RawTags: tags,
		Meta: &model.Meta{
			ContentType: config.Markdown,
			DocTitle:    title,
			DocHash:     fmt.Sprintf("%x", contents.hash()),
			Lang:        lang,
		},
	}
}

ParseMD parses given Markdown document input into a slice of tags.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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