d2format

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 17 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(n d2ast.Node) string

TODO: edges with shared path should be fmted as <rel>.(x -> y)

func FormatKeyPath added in v0.9.0

func FormatKeyPath(a []d2ast.String) string

FormatKeyPath formats the scalar values in a as a canonical key path, like Format(d2ast.MakeKeyPathString(a)), without building a temporary key path AST. Quoting in the input nodes is intentionally ignored, just as in MakeKeyPathString.

func FormatMarkdown added in v0.10.0

func FormatMarkdown(ctx context.Context, path string, source []byte) ([]byte, error)

FormatMarkdown formats the D2 fenced code blocks in source. Other Markdown content, including both fence markers, is preserved. Errors are positioned in the Markdown document, and no output is returned if a block cannot be formatted.

func KeyPath

func KeyPath(kp *d2ast.KeyPath) (ida []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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