Documentation
¶
Overview ¶
Package figures is a extension for the goldmark (http://github.com/yuin/goldmark).
This extension adds html render for paragraph with image output as figure.
An image with nonempty alt text, occurring by itself in a paragraph, will be rendered as a figure with a caption. The image’s alt text will be used as the caption.
](image.png "title")
This syntax is borrowed from [Pandoc](https://pandoc.org/MANUAL.html#images).
If you just want a regular inline image, just make sure it is not the only thing in the paragraph. One way to do this is to insert a nonbreaking space after the image:
\
Example ¶
package main
import (
"log"
"os"
figures "github.com/mdigger/goldmark-figures"
"github.com/yuin/goldmark"
)
func main() {
var source = []byte(`
](image.png "title")

](image.png "title")

`)
var md = goldmark.New(figures.Enable)
err := md.Convert(source, os.Stdout)
if err != nil {
log.Fatal(err)
}
}
Output: <figure> <img src="image.png" alt="Figure: description" title="title"> <figcaption><strong>Figure:</strong> <a href="/link">description</a></figcaption> </figure> <p><img src="image.png" alt="" title="title"></p> <p><img src="image.png" alt="Figure: description" title="title"> <img src="image.png" alt="alt" title="title"></p>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var Enable = goldmark.WithExtensions(Extension)
Enable is a goldmark.Option with image figures support.
var Extension goldmark.Extender = new(extension)
Extension is a goldmark.Extender with markdown image figures support.
Functions ¶
This section is empty.
Types ¶
This section is empty.