Dagger
Search

diagrams

This module provides you the ability to pass in your diagram script language and get an image back.

The first language supported is D2 (https://d2lang.com/). Mermaid support is in progress.

Installation

dagger install github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081

Entrypoint

Return Type
Diagrams
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
func (m *myModule) example() *Diagrams  {
	return dag.
			Diagrams()
}
@function
def example() -> dag.Diagrams:
	return (
		dag.diagrams()
	)
@func()
example(): Diagrams {
	return dag
		.diagrams()
}

Types

Diagrams 🔗

build() 🔗

Build the base images

Return Type
Container !
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 build
func (m *myModule) example() *Container  {
	return dag.
			Diagrams().
			Build()
}
@function
def example() -> dagger.Container:
	return (
		dag.diagrams()
		.build()
	)
@func()
example(): Container {
	return dag
		.diagrams()
		.build()
}

base() 🔗

Setup base image

Return Type
Container !
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 base
func (m *myModule) example() *Container  {
	return dag.
			Diagrams().
			Base()
}
@function
def example() -> dagger.Container:
	return (
		dag.diagrams()
		.base()
	)
@func()
example(): Container {
	return dag
		.diagrams()
		.base()
}

d2() 🔗

Generate diagram using D2

Return Type
D2 !
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 d-2
func (m *myModule) example() *DiagramsD2  {
	return dag.
			Diagrams().
			D2()
}
@function
def example() -> dag.DiagramsD2:
	return (
		dag.diagrams()
		.d2()
	)
@func()
example(): DiagramsD2 {
	return dag
		.diagrams()
		.d2()
}

D2 🔗

container() 🔗

Return Type
Container !
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 d-2 \
 container
func (m *myModule) example() *Container  {
	return dag.
			Diagrams().
			D2().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.diagrams()
		.d2()
		.container()
	)
@func()
example(): Container {
	return dag
		.diagrams()
		.d2()
		.container()
}

render() 🔗

Render diagram text to image

Return Type
File !
Arguments
NameTypeDefault ValueDescription
fileFile !-File to render with D2
themeString !"100"Theme to use for render
formatString !"svg"Export format
animateIntervalString -Animation interval timing for animated SVG exports
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 d-2 \
 render --file file:path --theme string --format string
func (m *myModule) example(file *File, theme string, format string) *File  {
	return dag.
			Diagrams().
			D2().
			Render(file, theme, format)
}
@function
def example(file: dagger.File, theme: str, format: str) -> dagger.File:
	return (
		dag.diagrams()
		.d2()
		.render(file, theme, format)
	)
@func()
example(file: File, theme: string, format: string): File {
	return dag
		.diagrams()
		.d2()
		.render(file, theme, format)
}

themes() 🔗

List available themes

Return Type
String !
Example
dagger -m github.com/marvinmartian/daggerverse/diagrams@abdd0af1688d8de443435c811eed3ba6bb53a081 call \
 d-2 \
 themes
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			Diagrams().
			D2().
			Themes(ctx)
}
@function
async def example() -> str:
	return await (
		dag.diagrams()
		.d2()
		.themes()
	)
@func()
async example(): Promise<string> {
	return dag
		.diagrams()
		.d2()
		.themes()
}