...

Package d2compiler

import "oss.terrastruct.com/d2/d2compiler"
Overview
Index

Overview ▾

Package d2compiler implements a parser, compiler and autoformatter for the Terrastruct d2 diagramming language.

Variables

var FullToShortLanguageAliases map[string]string

TODO add more, e.g. C, bash

var ShortToFullLanguageAliases = map[string]string{
    "md":  "markdown",
    "tex": "latex",
    "js":  "javascript",
    "go":  "golang",
    "py":  "python",
    "rb":  "ruby",
    "ts":  "typescript",
}

func Compile

func Compile(p string, r io.Reader, opts *CompileOptions) (*d2graph.Graph, *d2target.Config, error)

type CompileOptions

type CompileOptions struct {
    UTF16Pos bool
    // FS is the file system used for resolving imports in the d2 text.
    // It should correspond to the root path.
    FS fs.FS
}