plugin

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package plugin contains all the rules that are not part of Commonmark like GitHub Flavored Markdown.

Index

Constants

View Source
const (
	VimeoOnlyThumbnail vimeoVariation = iota
	VimeoWithTitle
	VimeoWithDescription
)

Configure how the Vimeo Plugin should display the video in markdown.

Variables

View Source
var EXPERIMENTALYoutubeEmbed = []md.Rule{
	{
		Filter: []string{"iframe"},
		Replacement: func(content string, selec *goquery.Selection, opt *md.Options) *string {
			src := selec.AttrOr("src", "")
			if !strings.Contains(src, "youtube.com") {
				return nil
			}
			alt := selec.AttrOr("title", "")

			parts := youtubeID.FindStringSubmatch(src)
			if len(parts) != 2 {
				return nil
			}
			id := parts[1]

			text := fmt.Sprintf("[![%s](https://img.youtube.com/vi/%s/0.jpg)](https://www.youtube.com/watch?v=%s)", alt, id, id)
			return &text
		},
	},
}

EXPERIMENTALYoutubeEmbed registers a rule (for iframes) and returns a markdown compatible representation (link to video, ...).

View Source
var Timeout = time.Second * 10

Timeout for the http client

Functions

func ConfluenceAttachments

func ConfluenceAttachments() md.Plugin

ConfluenceAttachments converts `<ri:attachment ri:filename=""/>` elements [Contributed by @Skarlso]

func ConfluenceCodeBlock

func ConfluenceCodeBlock() md.Plugin

ConfluenceCodeBlock converts `<ac:structured-macro>` elements that are used in Atlassian’s Wiki “Confluence”. [Contributed by @Skarlso]

func EXPERIMENTALFrontMatter

func EXPERIMENTALFrontMatter(format string) md.Plugin

EXPERIMENTALFrontMatter was an experiment to add certain data from a callback function into the beginning of the file as frontmatter. It not really working right now.

If someone has a need for it, let me know what your use-case is. Then I can create a plugin with a good interface.

func EXPERIMENTALMoveFrontMatter

func EXPERIMENTALMoveFrontMatter(delimiters ...rune) md.Plugin

EXPERIMENTALMoveFrontMatter moves a frontmatter block at the beginning of the document to the top of the generated markdown block, without touching (and escaping) it.

func EXPERIMENTALVimeoEmbed

func EXPERIMENTALVimeoEmbed(variation vimeoVariation) md.Plugin

EXPERIMENTALVimeoEmbed registers a rule (for iframes) and returns a markdown compatible representation (link to video, ...).

func GitHubFlavored

func GitHubFlavored() md.Plugin

GitHubFlavored is GitHub's Flavored Markdown

func Strikethrough

func Strikethrough(character string) md.Plugin

Strikethrough converts `<strike>`, `<s>`, and `<del>` elements

func Table

func Table() md.Plugin

Table converts a html table (using hyphens and pipe characters) to a visuall representation in markdown.

Note: This Plugin overrides the default compatibility rules from `commonmark.go`. Only use this Plugin in an environment that has extendeded the normal syntax, like GitHub's Flavored Markdown.

func TableCompat

func TableCompat() md.Plugin

TableCompat is a compatibility plugon for environments where only commonmark markdown (without Tables) is supported.

Note: In an environment that supports "real" Tables, like GitHub's Flavored Markdown use `plugin.Table()` instead.

func TaskListItems

func TaskListItems() md.Plugin

TaskListItems converts checkboxes into task list items.

Types

This section is empty.

Jump to

Keyboard shortcuts

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