Files
BitLogger/docs/api/style-tag-registry.md
Nanaloveyuki 25a6a973d2 πŸ“ Update More API Document
2026-05-20 11:37:49 +08:00

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
registry
formatter
public

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 for set_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(...) through with_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

  1. This helper creates a runtime registry, not a serializable config map.

  2. Use default_style_tag_registry() when you want the built-in tag set as a starting point.