aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/mangoumbrella/goldmark-figure/figure.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mangoumbrella/goldmark-figure/figure.go')
-rw-r--r--vendor/github.com/mangoumbrella/goldmark-figure/figure.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/mangoumbrella/goldmark-figure/figure.go b/vendor/github.com/mangoumbrella/goldmark-figure/figure.go
new file mode 100644
index 0000000..00ec574
--- /dev/null
+++ b/vendor/github.com/mangoumbrella/goldmark-figure/figure.go
@@ -0,0 +1,36 @@
1// Copyright 2023 The goldmark-figure authors
2//
3// Use of this source code is governed by an MIT-style
4// license that can be found in the LICENSE file or at
5// https://opensource.org/licenses/MIT.
6package figure
7
8import (
9 "github.com/mangoumbrella/goldmark-figure/ast"
10 "github.com/yuin/goldmark"
11 aparser "github.com/yuin/goldmark/parser"
12 "github.com/yuin/goldmark/renderer"
13 "github.com/yuin/goldmark/util"
14
15 fparser "github.com/mangoumbrella/goldmark-figure/parser"
16)
17
18type extension struct {
19}
20
21// Figure is an extension to render <figure> elements.
22var Figure = &extension{}
23
24func (f *extension) Extend(m goldmark.Markdown) {
25 m.Parser().AddOptions(
26 aparser.WithParagraphTransformers(
27 util.Prioritized(fparser.NewFigureParagraphTransformer(), 120),
28 ),
29 aparser.WithASTTransformers(
30 util.Prioritized(fparser.NewFigureASTTransformer(), 0),
31 ),
32 )
33 m.Renderer().AddOptions(renderer.WithNodeRenderers(
34 util.Prioritized(ast.NewFigureHTMLRenderer(), 0),
35 ))
36}