wikilinks

package module
v0.0.0-...-1c23d2b Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 10 Imported by: 0

README

GoDev

goldmark-wikilinks is an extension for the goldmark that allows you to use Wikimedia style links in Markdown documents.

Usage

Installation
go get go.teddydd.me/goldmark-wikilinks
Markdown syntax

Example:

This is link for given [[topic]]

This link has [[alt text|topic]]

This is TiddlyWiki style image link [image[hello world]]

License

MIT

Author

Daniel Lewan

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Wikilinks = &wikilinks{}

Functions

func NewParser

func NewParser(opts ...ParserOption) parser.InlineParser

func NewRenderer

func NewRenderer(opts ...RendererOption) renderer.NodeRenderer

Types

type AltTextOrder

type AltTextOrder int
const (
	FirstAltText AltTextOrder = iota
	FirstSource
)

type ParserOption

type ParserOption interface {
	parser.Option
	SetWikilinksOption(*WikilinksConfig)
}

A ParserOption interface sets options for the ParserOption.

func WithAltTextOrder

func WithAltTextOrder(value AltTextOrder) ParserOption

func WithTrimSpaces

func WithTrimSpaces(value bool) ParserOption

type RenderFunc

type RenderFunc func(util.BufWriter, ast.Node)

type RendererConfig

type RendererConfig struct {
	html.Config

	Method     RenderingMethod
	RenderFunc RenderFunc
}

func (*RendererConfig) SetOption

func (c *RendererConfig) SetOption(name renderer.OptionName, value interface{})

SetOption implements renderer.SetOptioner.

type RendererOption

type RendererOption interface {
	renderer.Option

	SetRendererOption(*RendererConfig)
}

A RendererOption interface sets options for the emoji renderer.

func WithRenderFunc

func WithRenderFunc(a RenderFunc) RendererOption

func WithRenderingMethod

func WithRenderingMethod(a RenderingMethod) RendererOption

WithRenderingMethod is a functional option that indicates how links are rendered.

type RenderingMethod

type RenderingMethod int
const (
	Link RenderingMethod = iota
	Func
)

type WikilinksConfig

type WikilinksConfig struct {
	AltTextOrder AltTextOrder
	TrimSpaces   bool
}

ParserConfig is a data structure that holds configuration of Wikilinks extension

func (*WikilinksConfig) SetOption

func (w *WikilinksConfig) SetOption(name parser.OptionName, value interface{})

SetOption implements SetOptioner.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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