Configuration File
Emlang uses a .emlang.yaml file for project configuration. The CLI resolves the configuration file in the following order:
- The
-cflag:emlang -c path/to/config.yaml - The
EMLANG_CONFIGenvironment variable - A
.emlang.yamlfile in the current working directory
lint
Configuration for the linter. Use the ignore list to disable specific rules.
lint.ignore
Type: array of strings — list of rule names to ignore.
lint:
ignore:
- slice-missing-event
- command-without-event
Available Rules
| Rule | Severity | Description |
|---|---|---|
command-without-event |
warning | Command not followed by event or exception |
orphan-exception |
warning | Exception without preceding command |
slice-missing-event |
warning | Slice without events |
trigger-without-command |
warning | Trigger not followed by a command before the next trigger |
unknown-test-element |
warning | Test element that is not a step of any slice in the same document. Exceptions are not checked. |
view-without-event |
warning | View that no event comes before, in any slice of the same document |
fmt
Configuration for the formatter.
fmt.keys
Type: string — key style for formatted output. Options: "long" or "short". Default: "long".
long— full type names:trigger,command,event,exception,viewshort— abbreviated keys:t,c,e,x,v
fmt:
keys: long
diagram
Configuration for the generated diagram.
diagram.serve
Settings for the live-reload server started with emlang diagram --serve.
diagram.serve.address
Type: string — listen address. Default: "127.0.0.1".
diagram.serve.port
Type: int — listen port. Default: 8274.
diagram:
serve:
address: 127.0.0.1
port: 8274
diagram.css
Use the css map to override default CSS custom properties.
Type: map of string to string — CSS variable name to value.
diagram:
css:
--command-bg-color: "#dbe4ff"
--label-font-size: "0.8em"
Available CSS Variables
| Variable | Default | Description |
|---|---|---|
| Colors | ||
--diagram-bg-color |
#ffffff |
Diagram background |
--diagram-text-color |
#212529 |
Main text color, and connectors between elements |
--diagram-border-color |
#ced4da |
Border color |
--trigger-bg-color |
#e9ecef |
Trigger background |
--command-bg-color |
#a5d8ff |
Command background |
--event-bg-color |
#ffd8a8 |
Event background |
--exception-bg-color |
#ffc9c9 |
Exception background |
--view-bg-color |
#b2f2bb |
View background |
| Sizes | ||
--item-border-radius |
0.5em |
Item border radius |
--item-width |
auto |
Item base width |
--item-min-width |
8em |
Item minimum width |
--item-max-width |
none |
Item maximum width |
| Typography | ||
--diagram-font-family |
system-ui |
Normal font family |
--slicename-font-size |
2em |
Slice name font size |
--slicename-font-weight |
normal |
Slice name font weight |
--swimlane-font-size |
1.5em |
Swimlane font size |
--swimlane-font-weight |
normal |
Swimlane font weight |
--testname-font-size |
1em |
Test name font size |
--testname-font-weight |
bold |
Test name font weight |
--label-font-size |
0.75em |
Label font size |
--label-font-weight |
normal |
Label font weight |
--props-font-family |
monospace |
Props font family |
--props-font-size |
0.75em |
Props font size |
--props-font-weight |
normal |
Props font weight |
--comment-font-size |
0.875em |
Comment font size |
--comment-text-color |
#495057 |
Comment text color |
An item never gets narrower than --item-min-width. When a row does not fit, the diagram gets wider than the page instead of squeezing the items.
Deprecated CSS Variables
Older names of the CSS variables still work until the next major version.
emlang diagramprints a warning for each older name it finds, with the name to use.- When a config sets both names, the current name wins.
| Deprecated | Current |
|---|---|
--background-color |
--diagram-bg-color |
--text-color |
--diagram-text-color |
--border-color |
--diagram-border-color |
--font-family-normal |
--diagram-font-family |
--trigger-color |
--trigger-bg-color |
--command-color |
--command-bg-color |
--event-color |
--event-bg-color |
--exception-color |
--exception-bg-color |
--view-color |
--view-bg-color |
--font-size-slicename |
--slicename-font-size |
--font-weight-slicename |
--slicename-font-weight |
--font-size-swimlane |
--swimlane-font-size |
--font-weight-swimlane |
--swimlane-font-weight |
--font-size-testname |
--testname-font-size |
--font-weight-testname |
--testname-font-weight |
--font-size-label |
--label-font-size |
--font-weight-label |
--label-font-weight |
--font-family-props |
--props-font-family |
--font-size-props |
--props-font-size |
--font-weight-props |
--props-font-weight |
Full Example
A complete .emlang.yaml configuration file with all available options:
# Emlang configuration file
lint:
ignore:
- slice-missing-event
- command-without-event
- orphan-exception
fmt:
keys: long
diagram:
serve:
address: 127.0.0.1
port: 8274
css:
# Colors
--diagram-bg-color: "#ffffff"
--diagram-text-color: "#212529"
--diagram-border-color: "#ced4da"
--trigger-bg-color: "#e9ecef"
--command-bg-color: "#a5d8ff"
--event-bg-color: "#ffd8a8"
--exception-bg-color: "#ffc9c9"
--view-bg-color: "#b2f2bb"
# Sizes
--item-border-radius: "0.5em"
--item-width: "auto"
--item-min-width: "8em"
--item-max-width: "none"
# Typography
--diagram-font-family: "system-ui"
--slicename-font-size: "2em"
--slicename-font-weight: "normal"
--swimlane-font-size: "1.5em"
--swimlane-font-weight: "normal"
--testname-font-size: "1em"
--testname-font-weight: "bold"
--label-font-size: "0.75em"
--label-font-weight: "normal"
--props-font-family: "monospace"
--props-font-size: "0.75em"
--props-font-weight: "normal"
--comment-font-size: "0.875em"
--comment-text-color: "#495057"