render

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package render emits deterministic D2 and self-contained SVG diagrams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(g *graph.Graph, options Options) (string, error)

func IconURL

func IconURL(icon string) string

IconURL is the public location of a catalog icon.

func IconURLs

func IconURLs(g *graph.Graph) map[string]string

IconURLs maps each catalog icon type in the graph to its public URL. It makes no requests; D2 output uses these portable references instead of cache paths.

func SVG

func SVG(ctx context.Context, input, layout, iconDir string) ([]byte, error)

SVG compiles D2 source and inlines icons. Relative icon references are resolved against iconDir.

Types

type IconSet

type IconSet struct {
	Dir   string
	Files map[string]string
}

IconSet holds icon files by resource type, named relative to Dir. Relative names keep the D2 source, and so the SVG, independent of the cache location.

func Icons

func Icons(ctx context.Context, g *graph.Graph) (IconSet, []string)

type Options

type Options struct {
	Title  string
	Icons  map[string]string
	Colors map[string]string
	Legend string
}

Jump to

Keyboard shortcuts

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