mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-03 19:17:00 +01:00
chore: Update bits syntax to use +<count>
This commit is contained in:
@@ -19,14 +19,15 @@ start-end: "Block name" %% Multi-bit blocks
|
||||
|
||||
### Bits Syntax (v<MERMAID_RELEASE_VERSION>+)
|
||||
|
||||
Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `bit` or `bits` interchangeably to set the number of bits, thus:
|
||||
Using start and end bit counts can be difficult, especially when modifying a design. For this we add a bit count field, which starts from the end of the previous field automagically. Use `+<count>` to set the number of bits, thus:
|
||||
|
||||
````md
|
||||
```md
|
||||
packet-beta
|
||||
1bit: "Block name" %% Single-bit block
|
||||
8bits: "Block name" %% 8-bit block
|
||||
+1: "Block name" %% Single-bit block
|
||||
+8: "Block name" %% 8-bit block
|
||||
9-15: "Manually set start and end, it's fine to mix and match"
|
||||
... More Fields ...
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -35,8 +36,8 @@ packet-beta
|
||||
title: "TCP Packet"
|
||||
---
|
||||
packet-beta
|
||||
16bits: "Source Port"
|
||||
16bits: "Destination Port"
|
||||
0-15: "Source Port"
|
||||
16-31: "Destination Port"
|
||||
32-63: "Sequence Number"
|
||||
64-95: "Acknowledgment Number"
|
||||
96-99: "Data Offset"
|
||||
@@ -53,13 +54,12 @@ packet-beta
|
||||
160-191: "(Options and Padding)"
|
||||
192-255: "Data (variable length)"
|
||||
```
|
||||
````
|
||||
|
||||
```mermaid-example
|
||||
packet-beta
|
||||
title UDP Packet
|
||||
0-15: "Source Port"
|
||||
16-31: "Destination Port"
|
||||
+16: "Source Port"
|
||||
+16: "Destination Port"
|
||||
32-47: "Length"
|
||||
48-63: "Checksum"
|
||||
64-95: "Data (variable length)"
|
||||
|
||||
Reference in New Issue
Block a user