Help us shape the future of Go! Take the 2026 Go Developer Survey

render

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package render turns expanded D2 into SVG using D2's Go packages, so inkline needs no d2 executable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SVG

func SVG(ctx context.Context, doc string, opts Options) ([]byte, error)

SVG renders expanded D2. Theme, padding and layout engine come from the d2-config the design system's prelude writes.

Types

type Options

type Options struct {
	// Path is the source file's path. D2 imports resolve against its
	// directory within FS, or on disk when FS is nil.
	Path string
	FS   fs.FS
	// IconPath is the source file's path on disk. Icon files named by the
	// diagram resolve against its directory.
	IconPath string
	// Font is the design system's font family, or nil for D2's default.
	Font *d2fonts.FontFamily
	// Router draws connections that cross between nested layouts (grid
	// cells, for example). Nil keeps D2's default: straight lines.
	Router d2graph.RouteEdges
}

Options configure one render.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL