-
Notifications
You must be signed in to change notification settings - Fork 0
Text Formatting
Applies to all versions (1.21.1 and 26.2).
All text shown in a book (page text fields, template text, landing_text, tooltips) is processed for $(...) commands. A command is written as $(name) or, for functions that take an argument, $(name:argument). Text can be nested and styles stack.
| Code | Description |
|---|---|
$(0) … $(9)
|
Minecraft color by code (0 is black, 9 is blue). |
$(a) … $(f)
|
Minecraft colors (a is green … f is white). |
$(#rgb) |
Short hexadecimal color, for example $(#f00) for red. |
$(#rrggbb) |
Full hexadecimal color, for example $(#ff8800). |
$(nocolor) resets the color to the book's base text color.
"text": "$(c)Red $()plain $(#4a9)green-ish"| Code | Alias | Effect |
|---|---|---|
$(l) |
$(bold) |
Bold |
$(o) |
$(italic), $(italics)
|
Italic |
$(n) |
$(underline) |
Underline |
$(m) |
$(strike) |
Strikethrough |
$(k) |
$(obf) |
Obfuscated |
Note the ambiguity:
$(l)(no colon) is bold, while$(l:...)(with a colon) is a link. The same applies to$(k)(obfuscated) versus$(k:...)(keybind).
| Code | Description |
|---|---|
$() |
Reset styles, links and tooltips. $() is also produced by the /$ macro. |
$(reset) |
Alias of $(). |
$(clear) |
Alias of $(). |
Because a bare reset is easy to write by accident, the /$ macro is provided so that $(/$) expands to $().
| Code | Description |
|---|---|
$(br) |
Single line break. |
$(br2) |
Double line break (blank line). Aliases: $(2br), $(p). |
The <br> macro also expands to $(br).
| Code | Description |
|---|---|
$(li) |
First-level bullet. |
$(li2) |
Second-level bullet (hollow). |
$(li3) … |
Deeper levels alternate between filled and hollow. |
The default macro $(list expands to $(li, so $(list) works and produces a first-level bullet.
Links use the l function and are closed with $(/l):
$(l:target)link text$()
- External links: if the target starts with
http:orhttps:, it opens in the browser. An external link is marked with a trailing arrow glyph. - Internal links: otherwise the target is an entry or category id. If it has no namespace, the book's own namespace is used. An optional
#anchornavigates to the page carrying that anchor. -
$(l:entry#anchor)jumps to the page whoseanchorfield matches. - A link shows a tooltip with the target's name, or "(Locked)" if it is still locked.
"text": "$(l:mymod:basics/introduction)Read the introduction$() or $(l:https://github.com/codex-skd/vellumli)visit the repository$()."$(t:tooltip text)visible text$()
The tooltip alias works too: $(tooltip:tooltip text). Closed with $(/t). Hovering the visible text shows the tooltip.
$(k:key.jump)
Shows the currently bound key for the keybind, with a tooltip. A missing keybind shows "N/A".
$(c:/give @s minecraft:stone)Give me stone$()
Clicking the text runs the command. The command alias is $(command:...). The argument must begin with /. Closed with $(/c).
$(playername) is replaced with the current player's name.
Macros are simple text substitutions applied before commands are processed. Default macros:
| Macro | Expands to |
|---|---|
$(list |
$(li |
/$ |
$() |
<br> |
$(br) |
$(item) |
$(#b0b) (a soft blue, for items) |
$(thing) |
$(#490) (a soft green, for things) |
You can add or override macros with the macros object in book.json. Substitution is repeated until it reaches a fixpoint, up to ten passes; a warning is logged if it does not settle (for example with a circular macro).
"macros": {
"$(mana)": "$(#55aaff)"
}Mods can register their own commands and functions on the client with VellumliAPI.get().registerCommand(...) and registerFunction(...). See API.
Vellumli is a fork of Patchouli by Vazkii and williewillus. This documentation is licensed under CC BY-NC-SA 3.0. Not affiliated with or endorsed by the Patchouli authors.