-
Notifications
You must be signed in to change notification settings - Fork 12
/
config.go
48 lines (35 loc) · 748 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package pdf
import (
"context"
"io"
"net/http"
"os"
"github.com/go-swiss/fonts"
"github.com/yuin/goldmark/util"
)
type Config struct {
Context context.Context
PDF PDF
// A source for images
ImageFS http.FileSystem
// All other options have sensible defaults
Styles Styles
// A cache for the fonts
FontsCache fonts.Cache
// For debugging
TraceWriter io.Writer
NodeRenderers util.PrioritizedSlice
}
func DefaultConfig() *Config {
c := &Config{}
c.Context = context.Background()
c.ImageFS = http.FS(os.DirFS("."))
c.Styles = DefaultStyles()
return c
}
func (c *Config) AddDefaultNodeRenderers() {
var nr NodeRenderer = &nodeRederFuncs{}
c.NodeRenderers = append(c.NodeRenderers,
util.Prioritized(nr, 1000),
)
}