package d2svg

Import Path
	github.com/pancsta/d2/d2renderers/d2svg (on go.dev)

Dependency Relation
	imports 39 packages, and imported by 2 packages

Involved Source Files class.go code.go d2svg implements an SVG renderer for d2 diagrams. The input is d2exporter's output font_corpus.go isometric.go markdown.go paint_validation.go table.go theme.go
Package-Level Type Names (total 2)
/* sort by: | */
( DiagramObject) GetID() string ( DiagramObject) GetZIndex() int github.com/pancsta/d2/d2target.Connection github.com/pancsta/d2/d2target.Shape
Center *bool DarkThemeID *int64 DarkThemeOverrides *d2target.ThemeOverrides Font string Isometric uses the native vector renderer with the compiled layout preserved. MasterID is passed when the diagram should use something other than its own hash for unique targeting Currently, that's when multi-boards are collapsed NoXMLTag *bool OmitVersion *bool Pad *int64 Salt *string the svg will be scaled by this factor, if unset the svg will fit to screen Sketch *bool ThemeID *int64 ThemeOverrides *d2target.ThemeOverrides func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) func RenderIsometric(ctx context.Context, diagram *d2target.Diagram, opts *RenderOpts, native *d2isometricimg.Options) ([]byte, error) func RenderMultiboard(diagram *d2target.Diagram, opts *RenderOpts) ([][]byte, error) func github.com/pancsta/d2/d2lib.Compile(ctx context.Context, input string, compileOpts *d2lib.CompileOptions, renderOpts *RenderOpts) (*d2target.Diagram, *d2graph.Graph, error)
Package-Level Functions (total 7)
func EmbedFonts(buf *bytes.Buffer, diagramHash, source string, fontFamily *d2fonts.FontFamily, monoFontFamily *d2fonts.FontFamily, corpus string)
func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error)
RenderIsometric produces the native vector geometry with the same document options as Render. Native options can supply an asset resolver, fallback fonts, and a maximum canvas; their dimensions are unscaled. Rendering preserves the compiled layout, including nested containers. Like other native exports, this function does not load external assets unless a resolver is supplied. Responsive dark themes, SVG appendices, and multi-board SVG animation are not yet implemented by this renderer. Static multi-board SVG files are supported through RenderMultiboard.
func RenderLegend(buf *bytes.Buffer, diagram *d2target.Diagram, diagramHash string, theme *d2themes.Theme) error
func RenderMultiboard(diagram *d2target.Diagram, opts *RenderOpts) ([][]byte, error)
func RenderText(text string, x, height float64) string
func ThemeCSS(diagramHash string, themeID *int64, darkThemeID *int64, overrides, darkOverrides *d2target.ThemeOverrides) (stylesheet string, err error)
Package-Level Variables (total 5)
var DEFAULT_DARK_THEME *int64 // no theme selected
MarkdownCSS is retained for compatibility with callers that used the browser-era Markdown stylesheet directly. Deprecated: native Markdown SVG does not use or inject this HTML stylesheet.
Package-Level Constants (total 6)
const DEFAULT_PADDING = 100
const LEGEND_FONT_SIZE = 14
const LEGEND_ICON_SIZE = 24
Legend constants