diff options
Diffstat (limited to 'vendor/github.com/mangoumbrella/goldmark-figure/README.md')
| -rw-r--r-- | vendor/github.com/mangoumbrella/goldmark-figure/README.md | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/vendor/github.com/mangoumbrella/goldmark-figure/README.md b/vendor/github.com/mangoumbrella/goldmark-figure/README.md new file mode 100644 index 0000000..22ad7a4 --- /dev/null +++ b/vendor/github.com/mangoumbrella/goldmark-figure/README.md @@ -0,0 +1,72 @@ +# goldmark-figure + +[](https://pkg.go.dev/github.com/mangoumbrella/goldmark-figure) +[](https://github.com/mangoumbrella/goldmark-figure/actions/workflows/test.yml/badge.svg?event=push) +[](https://goreportcard.com/report/github.com/mangoumbrella/goldmark-figure) + +[goldmark-figure](https://github.com/MangoUmbrella/goldmark-figure) is a +[goldmark](http://github.com/yuin/goldmark) +extension to parse mardown paragraphs that start with an image into HTML +`<figure>` elements. One nice thing is it doesn't use any new markdown +syntaxes. + +Example markdown source: + +```md + +Awesome caption about **Oscar** the kitty. +``` + +Render result: + +```html +<figure> + <img src="/path/to/cat.jpg" alt="Picture of Oscar." /> + <figcaption>Awesome caption about <strong>Oscar</strong> the kitty.</figcaption> +</figure> +``` + +# Installation + +``` +go get github.com/mangoumbrella/goldmark-figure +``` + +# Usage + +```go +import ( + "bytes" + "fmt" + + "github.com/mangoumbrella/goldmark-figure" + "github.com/yuin/goldmark" +) + +func main() { + markdown := goldmark.New( + goldmark.WithExtensions( + figure.Figure, + ), + ) + source := ` +  + Awesome caption about **Oscar** the kitty. + ` + var buf bytes.Buffer + if err := markdown.Convert([]byte(source), &buf); err != nil { + panic(err) + } + fmt.Print(buf.String()) +} +``` + +See [`figure_test.go`](/figure_test.go) for detailed usages. + +# LICENSE + +MIT + +# Authors + +Yilei Yang |
