# bytefield
a simple Obsidian plugin adding support for byte-field diagrams.
## usage
a byte-field diagram is one of those tables that show offsets of fields in e.g. network packets:
to create one, simply make a codeblock and add your fields.
```bytefield
field1: 3
field2: 4
field3: 1
```
every line has to contain the name of the field, `: ` as the delimiter and the length of the field in bytes. lines that do not contain `: ` are silently ignored, so feel free to use them as comments.
also, it is possible to change the offset where the diagram starts:
```bytefield
!curOffset: 7
field1: 5
field2: 3
field3: 4
```
fields are wrapped around if they're longer than the row:
also, to make an unnamed field that still takes up space (padding), just omit the part before the `: `:
```bytefield
field1: 3
: 1
field2: 4
```
## building
unlike most, this project is built with [Bun](https://bun.sh/). to build the `main.js` file:
```bash
bun run build
```
to watch:
```bash
bun run watch
```
doing it this way keeps minimal dependencies as Bun supports TypeScript out of the box, and also has a bundler built-in.