Documentation ¶
Overview ¶
Package images is a extension for the goldmark (http://github.com/yuin/goldmark).
This extension adds replacer render to change image urls.
Example ¶
package main import ( "log" "os" images "github.com/mdigger/goldmark-images" "github.com/yuin/goldmark" ) var source = []byte(`![alt](image.png "title")`) func imageURL(src string) string { return "test-" + src } func main() { gm := goldmark.New( images.NewReplacer(imageURL), ) if err := gm.Convert(source, os.Stdout); err != nil { log.Fatal(err) } }
Output: <p><img src="test-image.png" alt="alt" title="title"></p>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(r ReplaceFunc, options ...html.Option) goldmark.Extender
New return initialized image render with source url replacing support.
func NewReplacer ¶
func NewReplacer(r ReplaceFunc) goldmark.Option
NewReplacer adding src url replacing function to image html render.
Types ¶
type ReplaceFunc ¶
ReplaceFunc is a function for replacing image source link.
Click to show internal directories.
Click to hide internal directories.