Documentation ¶
Overview ¶
Example ¶
package main import ( "log" "os" images "github.com/fundipper/goldmark-images" "github.com/yuin/goldmark" ) var source = []byte(`![alt](image.png "title")`) func main() { md := goldmark.New( goldmark.WithExtensions( images.NewExtender( "/loading.gif", // source "data-src", // target map[string]string{ "class": "lazy", // arrtibute }), ), ) if err := md.Convert(source, os.Stdout); err != nil { log.Fatal(err) } }
Output: <p> <img src="/loading.gif" alt="alt" title="title" class="lazy" data-src="image.png"> </p>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExtender ¶
New return initialized image render with source url replacing support.
func NewRenderer ¶
func NewRenderer() renderer.NodeRenderer
NewRenderer builds a new Renderer with given options and returns it.
Types ¶
type Renderer ¶
Renderer struct is a renderer.NodeRenderer implementation for the extension.
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements NodeRenderer.RegisterFuncs interface.
Click to show internal directories.
Click to hide internal directories.