Skip to content

Commit

Permalink
docs: add new header features
Browse files Browse the repository at this point in the history
  • Loading branch information
jomaway committed Mar 10, 2024
1 parent 9d2feee commit 5d0e8c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/docs.typ
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ Showing a number. #positional
- Just add an `int` value with the number you would like to show.

Showing a text label for a number #positional
- Add a content field after the int value which the label belongs to.
- Add a content field after the int value which the label belongs to.
- To show a label without the number use the negativ number. _Example: (-5) instead of (5)_

#info[
Set the order of the bits with the `msb` argument directly on the `bytefield`.
Expand All @@ -221,6 +222,12 @@ You can use #named arguments to adjust the header styling.
- `fill` argument adds an background color to the header.
- `text-size` sets the size of the text.
- `stroke` defines the border style.
- `marker` [bool] defines if there is a marker line shown below the label.
- `marker: true`: shows a marker on each label.
- `marker: false`: no marker is shown at all.
- `marker: (true,false)`: shows markers only on labels with numbers.
- `marker: (false, true)`: shows markers only on labels without numbers.


=== Numbers and Labels example
You can also show labels and indexes by specifying a `content` after an `number` (`int`).
Expand Down
12 changes: 11 additions & 1 deletion lib/api.typ
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,24 @@
/// - `"bounds"` shows a number for every start and end bit of a field.
/// - `"offsets"` shows a number for every start bit of a field.
/// - numbers (auto, none): if none is specified no numbers will be shown on the header. This is useful to show only labels.
/// - marker (bool, array): defines if marker lines are shown under a label.
/// - angle (angle): The rotation angle of the label.
/// - fill (color): The background of the header.
/// - stroke (color): The border stroke of the header.
/// - text-size(length): The text-size for the header labels and numbers.
/// - ..args (int, content): The numbers and labels which should be shown on the header.
/// The number will only be shown if it is inside the range.
/// If a `content` value follows a `int` value it will be interpreted as label for this number.
/// For more information see the _manual_.
#let bitheader(
range: (auto,auto),
autofill: auto,
numbers: auto,
numbers: auto,
marker: true,
fill: auto,
stroke: auto,
text-size: auto,
angle: -60deg,
..args
) = {
// assertions
Expand Down

0 comments on commit 5d0e8c4

Please sign in to comment.