Replies: 3 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
|
Another way is to write your `AA BB `#text(red)[`CC `]`DD
0F `#highlight[`67`]` 3E `*`FF`* |
Beta Was this translation helpful? Give feedback.
-
|
As #text(font: "Fira Code")[
AA BB #text(red)[CC] DD\
0F #highlight[67] 3E *FF*
]Actually, it is quite easy to use show-rules here but those will match on every occurrence of a whatever it is you're matching. But besides that, it can be quite clean and you can even limit it to only codeblocks with your own language, called #show raw.where(lang: "hex"): r => {
show "00": set text(gray)
show "67": highlight.with(fill: yellow)
show "FF": strong
r
}
```hex
AA BB CC DD
0F 67 3E FF
CC 00 00 00
``` |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For some of my documents, I use
hexcontent, often taken from the output ofhexdump -C <some-file>.Within this
hexblock, I require to mark some parts (bytes or sequences of bytes) to be able to add comments on them and reference them in the text later on. Similar to how wireshark highlights text in a dump.In
LaTeX, using thelstlistingpackage, this could be achieved like this:Is a similar approach possible in Typst? Ideally the solution to this would be flexible: not only highlighting content, but also making it bold, italic, both, change the font, and so on.
I have been looking around but apart from building the block manually by running over the file and manipulating each character saperately (which is far from ideal) I have not really found a good approach myself.
Beta Was this translation helpful? Give feedback.
All reactions