Documentation
¶
Overview ¶
Package d2compiler implements a parser, compiler and autoformatter for the Terrastruct d2 diagramming language.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FullToShortLanguageAliases map[string]string
View Source
var ShortToFullLanguageAliases = map[string]string{
"md": "markdown",
"tex": "latex",
"js": "javascript",
"go": "golang",
"py": "python",
"rb": "ruby",
"ts": "typescript",
}
TODO add more, e.g. C, bash
Functions ¶
Types ¶
type CompileOptions ¶
type CompileOptions struct {
// Context stops parsing and compilation when canceled. A nil Context is treated as
// context.Background().
Context context.Context
UTF16Pos bool
// AnimateDuration overrides the root animate-duration, in milliseconds.
AnimateDuration *int64
// AnimateTweens controls sampling of step transitions. Nil follows
// the root animate-interval. False compiles only the authored endpoints.
AnimateTweens *bool
// MaxVariableExpansion bounds work added by variable substitutions and the
// automatic copies they induce. Zero uses d2ir.DefaultMaxVariableExpansion.
MaxVariableExpansion int64
// MaxGlobExpansion bounds work performed by glob matching and
// materialization. Zero uses d2ir.DefaultMaxGlobExpansion. Explicit source
// fields are not counted as materialization work.
MaxGlobExpansion int64
// MaxEdgeExpansion bounds distinct edge-segment and endpoint combinations
// considered by edge globs. Zero uses d2ir.DefaultMaxEdgeExpansion. Explicit
// edges do not consume this budget.
MaxEdgeExpansion int64
// MaxEdgeExpansionWork bounds all endpoint-pair examinations performed by
// edge globs, including lazy replays. Zero uses the secure compiler default.
MaxEdgeExpansionWork int64
// FS is the file system used for resolving imports in the D2 text. Nil
// disables imports. Callers that accept untrusted input should prefer a
// filesystem constrained to the intended import root; lib/localfile provides
// rooted and explicit unrestricted host-filesystem policies.
FS fs.FS
}
Click to show internal directories.
Click to hide internal directories.