generated from nginx/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 5
Mermaid: Add grid support and exampleSite example #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
description: Mermaid | ||
title: Mermaid | ||
toc: true | ||
--- |
156 changes: 156 additions & 0 deletions
156
exampleSite/content/test-product/mermaid/mermaid-grid.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
--- | ||
description: Mermaid grid | ||
title: Mermaid grid | ||
toc: true | ||
--- | ||
|
||
Mermaid supports multiple grid sizes, similar to [image grid]({{< relref "../images/image-grid.md" >}}). | ||
|
||
- `wide` | ||
- `last-third` | ||
- `first-third` | ||
- `first-two-thirds` (default) | ||
|
||
This attribute is provided as part of the codeblock options for `mermaid`. | ||
|
||
### Wide | ||
To use the full, wide grid: | ||
``` | ||
```mermaid {grid="wide"} | ||
|
||
``` | ||
|
||
|
||
```mermaid {grid="wide"} | ||
graph LR | ||
%% Nodes and Relationships | ||
subgraph KubernetesCluster["Kubernetes Cluster"] | ||
subgraph NamespaceNGF["Namespace: nginx-gateway"] | ||
NGFControlPlanePod["NGINX Gateway Fabric Control Plane Pod"] | ||
NGFControlPlanePod --> KubernetesAPI["Kubernetes API"] | ||
end | ||
subgraph ApplicationsNamespaceA["Namespace: applications"] | ||
subgraph DataplaneComponentsA["Dataplane Components"] | ||
GatewayA["Gateway A<br>Listener: *.example.com"] | ||
subgraph NGINXDataPlanePodA["NGINX Data Plane Pod"] | ||
subgraph NGINXContainerA["NGINX Container"] | ||
NGINXProcessA["NGINX Process"] | ||
NGINXAgentA["NGINX Agent"] | ||
end | ||
end | ||
end | ||
subgraph HTTPRouteAAndApplications["HTTPRoutes and Applications"] | ||
HTTPRouteA["HTTPRoute A<br>Host: a.example.com"] | ||
HTTPRouteB["HTTPRoute B<br>Host: b.example.com"] | ||
ApplicationA["Application A<br>Pods: 2"] | ||
ApplicationB["Application B<br>Pods: 1"] | ||
end | ||
end | ||
subgraph ApplicationsNamespaceB["Namespace: applications-2"] | ||
subgraph DataplaneComponentsB["Dataplane Components"] | ||
GatewayB["Gateway B<br>Listener: *.other-example.com"] | ||
subgraph NGINXDataPlanePodB["NGINX Data Plane Pod"] | ||
subgraph NGINXContainerB["NGINX Container"] | ||
NGINXProcessB["NGINX Process"] | ||
NGINXAgentB["NGINX Agent"] | ||
end | ||
end | ||
end | ||
subgraph HTTPRouteBandApplications["HTTPRoutes and Applications"] | ||
HTTPRouteC["HTTPRoute C<br>Host: c.other-example.com"] | ||
ApplicationC["Application C<br>Pods: 1"] | ||
end | ||
end | ||
end | ||
subgraph UsersAndClients["Users and Clients"] | ||
UserOperator["Cluster Operator"] | ||
UserDevA["Application Developer A"] | ||
UserDevB["Application Developer B"] | ||
ClientA["Client A"] | ||
ClientB["Client B"] | ||
end | ||
subgraph SharedInfrastructure["Public Endpoint"] | ||
PublicEndpoint["TCP Load Balancer / NodePort"] | ||
end | ||
%% Updated Traffic Flow | ||
ClientA-->|a.example.com|PublicEndpoint | ||
ClientB-->|c.other-example.com|PublicEndpoint | ||
PublicEndpoint==>NGINXProcessA | ||
PublicEndpoint==>NGINXProcessB | ||
NGINXProcessA==>ApplicationA | ||
NGINXProcessA==>ApplicationB | ||
NGINXProcessB==>ApplicationC | ||
%% Kubernetes Configuration Flow | ||
HTTPRouteA-->GatewayA | ||
HTTPRouteB-->GatewayA | ||
HTTPRouteC-->GatewayB | ||
UserOperator-->KubernetesAPI | ||
NGFControlPlanePod--gRPC-->NGINXAgentA | ||
NGFControlPlanePod--gRPC-->NGINXAgentB | ||
NGINXAgentA-->NGINXProcessA | ||
NGINXAgentB-->NGINXProcessB | ||
UserDevA-->KubernetesAPI | ||
UserDevB-->KubernetesAPI | ||
%% Styling | ||
style UserOperator fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style GatewayA fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style GatewayB fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style NGFControlPlanePod fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style NGINXProcessA fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style NGINXProcessB fill:#66CDAA,stroke:#333,stroke-width:2px | ||
style KubernetesAPI fill:#9370DB,stroke:#333,stroke-width:2px | ||
style HTTPRouteAAndApplications fill:#E0FFFF,stroke:#333,stroke-width:2px | ||
style HTTPRouteBandApplications fill:#E0FFFF,stroke:#333,stroke-width:2px | ||
style UserDevA fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style HTTPRouteA fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style HTTPRouteB fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style ApplicationA fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style ApplicationB fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style ClientA fill:#FFA07A,stroke:#333,stroke-width:2px | ||
style UserDevB fill:#87CEEB,stroke:#333,stroke-width:2px | ||
style HTTPRouteC fill:#87CEEB,stroke:#333,stroke-width:2px | ||
style ApplicationC fill:#87CEEB,stroke:#333,stroke-width:2px | ||
style ClientB fill:#87CEEB,stroke:#333,stroke-width:2px | ||
style PublicEndpoint fill:#FFD700,stroke:#333,stroke-width:2px | ||
``` | ||
|
||
### Last third | ||
Or an 'aside' style `last-third`: | ||
``` | ||
```mermaid {grid="last-third"} | ||
|
||
``` | ||
|
||
Some content on the left, where the graph would appear to the right. | ||
For this use case, you would want to make sure your text is similar height, or higher than the graph, or the document flow will look off. | ||
```mermaid {grid="last-third"} | ||
graph TD | ||
A[Start] --> B{Decision}; | ||
B -->|Yes| C[Process 1]; | ||
B -->|No| D[Process 2]; | ||
C --> E[End]; | ||
D --> E; | ||
``` | ||
|
||
|
||
### Default | ||
By default, it will use the "first-two-thirds" grid, if nothing is provided. | ||
|
||
``` | ||
```mermaid | ||
graph TD | ||
A[Start] --> B{Decision}; | ||
B -->|Yes| C[Process 1]; | ||
B -->|No| D[Process 2]; | ||
C --> E[End]; | ||
D --> E; | ||
``` | ||
|
||
```mermaid | ||
graph TD | ||
A[Start] --> B{Decision}; | ||
B -->|Yes| C[Process 1]; | ||
B -->|No| D[Process 2]; | ||
C --> E[End]; | ||
D --> E; | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<pre class="mermaid"> | ||
{{- $grid := .Attributes.grid | default "first-two-thirds" -}} | ||
<pre class="mermaid" data-grid="{{ $grid }}"> | ||
{{- .Inner | safeHTML }} | ||
</pre> | ||
{{ .Page.Store.Set "hasMermaid" true }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.