md

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

	defer in.Close()
	contents := ParseMD(in, c)

	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 := tagifyMD(contents, c)

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

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

Functions

This section is empty.

Types

type MDContents added in v0.56.0

type MDContents struct {
	// contains filtered or unexported fields
}

MDContents stores text from target tags.

func ParseMD

func ParseMD(reader io.Reader, cfg *config.Config) *MDContents

func (*MDContents) String added in v0.56.0

func (cnt *MDContents) String() string

Jump to

Keyboard shortcuts

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