From 5d0e8c4059a384e9c51f72f42b48e364ded3aa9c Mon Sep 17 00:00:00 2001 From: jomaway Date: Sun, 10 Mar 2024 21:13:15 +0100 Subject: [PATCH] docs: add new header features --- docs/docs.typ | 9 ++++++++- lib/api.typ | 12 +++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/docs.typ b/docs/docs.typ index 0e9fca4..fbba721 100644 --- a/docs/docs.typ +++ b/docs/docs.typ @@ -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`. @@ -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`). diff --git a/lib/api.typ b/lib/api.typ index 82748b9..cd27902 100644 --- a/lib/api.typ +++ b/lib/api.typ @@ -184,6 +184,11 @@ /// - `"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. @@ -191,7 +196,12 @@ #let bitheader( range: (auto,auto), autofill: auto, - numbers: auto, + numbers: auto, + marker: true, + fill: auto, + stroke: auto, + text-size: auto, + angle: -60deg, ..args ) = { // assertions