Skip to main content

Module text

Module text 

Source
Expand description

Builders for JSON text: each converts into a Text::Json, so it can be passed wherever text is shown.

  • text::mini writes Rift markup as {"mini": "...", "args": {...}}; Rift turns it into a component. See docs/text.md for the tags.
  • text::legacy writes &c codes as {"legacy": "...", "marker": "&"}.
  • text::Component builds a JSON text component field by field, with the 1.21.5 spellings click_event and hover_event (Rift rewrites them for older clients).

Every builder converts into Text and into a serde_json::Value for use inside other components, and implements Display (its JSON text). A bare string is never read as markup, so player input passed as an argument or as text cannot add tags or click events.

Structs§

Component
A JSON text component, built field by field.
Legacy
Legacy codes; see legacy.
Mini
Markup with named arguments; see mini.

Functions§

legacy
Legacy formatting codes with the & marker, such as &cRed &lbold; &#rrggbb writes a hex colour. Use Legacy::marker for another marker.
mini
Rift markup, such as <gold>Hi <player>!. Add arguments with Mini::arg and Mini::arg_component.