File: plugin.go

package info (click to toggle)
golang-github-johanneskaufmann-html-to-markdown 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,080 kB
  • sloc: makefile: 3
file content (22 lines) | stat: -rw-r--r-- 605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package converter

// Plugin can be used to extends functionality beyond what
// is offered by commonmark.
type Plugin interface {
	// The public name of the plugin, e.g. "strikethrough"
	Name() string

	// Init is called to initialize the plugin. It can be used to
	// *validate* the arguments and *register* the rules.
	Init(conv *Converter) error
}

// WithPlugins can be used to add additional functionality to the converter.
func WithPlugins(plugins ...Plugin) converterOption {
	return func(c *Converter) error {
		for _, plugin := range plugins {
			c.Register.Plugin(plugin)
		}
		return nil
	}
}