Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFrontMatterNotClosed error = errors.New("Missing closing frontmatter `---` found")
ErrFrontMatterNotClosed is raised to signal that the rules for defining a frontmatter element in a markdown document have been violated
Functions ¶
func InsertFrontMatter ¶
InsertFrontMatter prepends the content bytes with front matter enclosed in the standard marks ---
func StripFrontMatter ¶
StripFrontMatter splits a provided document into front-matter and content.
func UpdateLinkRefs ¶ added in v0.2.0
UpdateLinkRefs changes document links destinations, consulting with callback on the destination to use on each link or image in document. If a callback returns "" for a destination, this is interpreted as request to remove the link destination and leave only the link text or in case it's an image - to remvoe it completely. TODO: failfast vs fault tolerance support?
Types ¶
type OnLink ¶
type OnLink func(markdownType Type, destination, text, title []byte) ([]byte, []byte, []byte, error)
OnLink is a callback function invoked on each link by mardown#UpdateLinkRefs It is supplied a link and is expected to return destination, text, title or error. A nil destination will yield removing of this link/image markup, leaving only the text component if it's a link Nil text or title returned yield no change. Any other value replaces the original. If a returned title is empty string an originally existing title element will be completely removed