Render options¶
See the official Mermaid documentation for additional information.
c4.renderers.mermaid.options.MermaidRenderOptionsBuilder ¶
Builder for constructing MermaidRenderOptions.
Provides a fluent API for incrementally defining styles and layout configuration.
update_element_style ¶
update_element_style(
element: str | Element,
bg_color: str | None = None,
font_color: str | None = None,
border_color: str | None = None,
) -> Self
Adds an UpdateElementStyle() macro configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
str | Element
|
Element or alias of the element to style. |
required |
bg_color
|
str | None
|
Background color of the element. |
None
|
font_color
|
str | None
|
Text color of the element label. |
None
|
border_color
|
str | None
|
Border color of the element. |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options. |
update_rel_style ¶
update_rel_style(
from_element: str | Element,
to_element: str | Element,
text_color: str | None = None,
line_color: str | None = None,
offset_x: int | None = None,
offset_y: int | None = None,
) -> Self
Adds an UpdateRelStyle() macro configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_element
|
str | Element
|
Element or alias of the source element. |
required |
to_element
|
str | Element
|
Element or alias of the target element. |
required |
text_color
|
str | None
|
Color of the relationship label text. |
None
|
line_color
|
str | None
|
Color of the connecting line. |
None
|
offset_x
|
int | None
|
Optional horizontal offset for the label position. |
None
|
offset_y
|
int | None
|
Optional vertical offset for the label position. |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options. |
update_layout_config ¶
update_layout_config(
c4_shape_in_row: int | None = None,
c4_boundary_in_row: int | None = None,
) -> Self
Override default Mermaid layout configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c4_shape_in_row
|
int | None
|
Maximum number of non-boundary elements (e.g. systems, containers, components) per row. Default in Mermaid: 4. |
None
|
c4_boundary_in_row
|
int | None
|
Maximum number of boundaries per row. Default in Mermaid: 2. |
None
|
Returns:
| Type | Description |
|---|---|
Self
|
The updated render options. |
c4.renderers.mermaid.options.MermaidRenderOptions
dataclass
¶
Final render options for rendering a Mermaid C4 diagram.
This includes style overrides and layout configuration that will be translated into Mermaid directives/macros during rendering.
Attributes:
| Name | Type | Description |
|---|---|---|
styles |
list[BaseStyle]
|
Collection of style overrides applied to elements and relationships. |
update_layout_config |
UpdateLayoutConfig | None
|
Optional layout configuration override. If not provided, Mermaid defaults are used. |
Source code in c4/renderers/mermaid/options.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |