D2 Render Options¶
c4.renderers.d2.options.D2RenderOptionsBuilder ¶
Builder for constructing D2RenderOptions.
direction ¶
direction(direction: D2Direction | None) -> Self
Set the D2 layout direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
direction
|
D2Direction | None
|
One of |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
layout ¶
layout(layout: D2Layout) -> Self
Set the D2 layout engine for image export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout
|
D2Layout
|
One of |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
theme ¶
theme(theme: int | None) -> Self
Set the D2 theme ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
int | None
|
A non-negative integer D2 theme ID, or |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
title_near ¶
title_near(position: D2NearPosition | None) -> Self
Set the generated diagram title placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
D2NearPosition | None
|
One of the supported D2 |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
sequence_diagram ¶
sequence_diagram(enabled: bool = True) -> Self
Render DynamicDiagram output as a D2 sequence diagram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether DynamicDiagram output should include
|
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
auto_number_relationships ¶
auto_number_relationships(enabled: bool = True) -> Self
Prefix relationship labels with their render order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether relationship labels should be prefixed with
|
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
include_type_label ¶
include_type_label(enabled: bool = True) -> Self
Include or omit element type labels from Markdown labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether type labels should be included. |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
include_technology ¶
include_technology(enabled: bool = True) -> Self
Include or omit technology from visible element labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether technology should be included. |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
include_properties ¶
include_properties(enabled: bool = True) -> Self
Include or omit element properties in D2 output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether properties should be included. |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
bidirectional_relationships ¶
bidirectional_relationships(
strategy: D2BidirectionalRelationshipStrategy,
) -> Self
Set how bidirectional relationships are rendered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strategy
|
D2BidirectionalRelationshipStrategy
|
|
required |
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
fully_qualified_relationships ¶
fully_qualified_relationships(enabled: bool = True) -> Self
Use fully qualified D2 paths for relationship endpoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether relationship endpoints should always use full nested D2 paths. |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options builder. |
c4.renderers.d2.options.D2RenderOptions
dataclass
¶
Render options for the D2 renderer.
Attributes:
| Name | Type | Description |
|---|---|---|
direction |
D2Direction | None
|
Overall diagram layout direction. Set to |
layout |
D2Layout
|
D2 layout engine used by image export backends. |
theme |
int | None
|
Optional D2 theme ID. |
title_near |
D2NearPosition | None
|
Optional D2 |
sequence_diagram |
bool
|
Whether DynamicDiagram output should be emitted as a D2 sequence diagram. |
auto_number_relationships |
bool
|
Whether relationship labels should be prefixed with their render order. |
include_type_label |
bool
|
Whether element type labels appear in Markdown labels. |
include_technology |
bool
|
Whether element technology appears in labels. |
include_properties |
bool
|
Whether element properties are emitted. |
bidirectional_relationships |
D2BidirectionalRelationshipStrategy
|
How bidirectional relationships are
rendered. |
fully_qualified_relationships |
bool
|
Whether relationship endpoints always use fully qualified D2 paths. |
legend |
D2Legend | None
|
Optional structured D2 legend. |
Source code in c4/renderers/d2/options.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
c4.renderers.d2.options.D2Legend
dataclass
¶
Structured D2 legend render options.
Source code in c4/renderers/d2/options.py
72 73 74 75 76 77 | |
c4.renderers.d2.options.D2LegendElement
dataclass
¶
A D2 legend node sample.
Source code in c4/renderers/d2/options.py
46 47 48 49 50 51 52 53 54 55 | |
c4.renderers.d2.options.D2LegendRel
dataclass
¶
A D2 legend relationship sample.
Source code in c4/renderers/d2/options.py
58 59 60 61 62 63 64 65 66 67 68 69 | |