From 6e974daa746a0a1c4f79dc517ee34dc4491ccff9 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Sun, 11 Jun 2023 18:36:50 -0700 Subject: [PATCH] pass in fs --- d2lib/d2.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/d2lib/d2.go b/d2lib/d2.go index ede144a0f..d12423332 100644 --- a/d2lib/d2.go +++ b/d2lib/d2.go @@ -3,6 +3,7 @@ package d2lib import ( "context" "errors" + "io/fs" "os" "strings" @@ -20,6 +21,7 @@ import ( type CompileOptions struct { UTF16 bool + FS fs.FS MeasuredTexts []*d2target.MText Ruler *textmeasure.Ruler Layout func(context.Context, *d2graph.Graph) error @@ -42,6 +44,7 @@ func Compile(ctx context.Context, input string, opts *CompileOptions) (*d2target g, err := d2compiler.Compile(opts.InputPath, strings.NewReader(input), &d2compiler.CompileOptions{ UTF16: opts.UTF16, + FS: opts.FS, }) if err != nil { return nil, nil, err