commonmark

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// For example:
	//
	//  [view more](/about.html)
	LinkStyleInlined linkStyle = "inlined"

	LinkStyleReferencedIndex linkStyle = "referenced_index"
	LinkStyleReferencedShort linkStyle = "referenced_short"
)
View Source
const (
	// HeadingStyleATX is the heading style of prefixing the heading with "#" signs indicating the level. For example:
	//
	//  ## Heading
	HeadingStyleATX headingStyle = "atx"

	// HeadingStyleSetext is the heading style of putting "=" or "-" on the followed line. For example:
	//
	//  Heading
	//  -------
	HeadingStyleSetext headingStyle = "setext"
)
View Source
const (
	// LinkBehaviorRender renders the element as a link
	LinkBehaviorRender linkRenderingBehavior = "render"
	// LinkBehaviorSkip skips link rendering and falls back to the other rules (e.g. paragraph)
	LinkBehaviorSkip linkRenderingBehavior = "skip"
)

Variables

This section is empty.

Functions

func NewCommonmarkPlugin

func NewCommonmarkPlugin(opts ...OptionFunc) converter.Plugin

NewCommonmarkPlugin registers the markdown syntax of commonmark.

Types

type OptionFunc

type OptionFunc = func(config *config)

func WithBulletListMarker

func WithBulletListMarker(marker string) OptionFunc

"-", "+", or "*"

default: "-"

func WithCodeBlockFence

func WithCodeBlockFence(fence string) OptionFunc

``` or ~~~

default: ```

func WithEmDelimiter

func WithEmDelimiter(delimiter string) OptionFunc

_ or *

default: *

func WithHeadingStyle

func WithHeadingStyle(style headingStyle) OptionFunc

"setext" or "atx"

default: "atx"

func WithHorizontalRule

func WithHorizontalRule(rule string) OptionFunc

Any Thematic break

default: "* * *"

func WithLinkEmptyContentBehavior added in v2.2.2

func WithLinkEmptyContentBehavior(behavior linkRenderingBehavior) OptionFunc

WithLinkEmptyContentBehavior configures how links *without content* are rendered. Take for example:

<a href="/page"></a>

LinkBehaviorRenderAsLink would result in "[](/page)""

LinkBehaviorSkipLink would result in an empty string.

func WithLinkEmptyHrefBehavior added in v2.2.2

func WithLinkEmptyHrefBehavior(behavior linkRenderingBehavior) OptionFunc

WithLinkEmptyHrefBehavior configures how links with *empty hrefs* are rendered. Take for example:

<a href="">the link content</a>

LinkBehaviorRenderAsLink would result in "[the link content]()""

LinkBehaviorSkipLink would result in "the link content"

func WithListEndComment

func WithListEndComment(enabled bool) OptionFunc

func WithStrongDelimiter

func WithStrongDelimiter(delimiter string) OptionFunc

** or __

default: **

type ValidateConfigError

type ValidateConfigError struct {
	Key   string
	Value string

	// By default is "Key:Value" but can be
	// overriden to e.g. "--key=value"
	KeyWithValue string
	// contains filtered or unexported fields
}

TODO: should this be with the commonmark package? Or more general? TODO: Maybe make it an interface? And also have a GetPluginName function?

func (*ValidateConfigError) Error

func (e *ValidateConfigError) Error() string

Jump to

Keyboard shortcuts

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