mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
1.6 KiB
1.6 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| style-tag-registry | api | formatter | 20260520 | Create an empty style tag registry for custom formatter markup tags. |
|
Style-tag-registry
Create an empty StyleTagRegistry for custom formatter style tags. This is the starting point for defining named tags such as accent or aliases such as danger.
Interface
pub fn style_tag_registry() -> StyleTagRegistry {
output
StyleTagRegistry- Empty registry ready forset_tag(...)and alias operations.
Explanation
Detailed rules explaining key parameters and behaviors
- The returned registry starts empty.
- This helper is intended for runtime formatter customization in code.
- Registries created here can be attached to
text_formatter(...)throughwith_style_tags(...).
How to Use
Here are some specific examples provided.
When Need Custom Named Tags
When formatter markup should define project-specific tag names:
let tags = style_tag_registry().set_tag("accent", fg=Some("#4cc9f0"), bold=true)
In this example, the registry becomes the container for custom named styles.
Error Case
e.g.:
-
If the formatter never enables the relevant style markup mode, tags in the registry may remain unused.
-
An empty registry is valid, but it does not add any custom tags by itself.
Notes
-
This helper creates a runtime registry, not a serializable config map.
-
Use
default_style_tag_registry()when you want the built-in tag set as a starting point.