Add style tag registry overrides

This commit is contained in:
Nanaloveyuki
2026-05-10 14:50:06 +08:00
parent b1b2235160
commit 3b6536f980
3 changed files with 342 additions and 21 deletions
+4 -1
View File
@@ -11,6 +11,8 @@ version 0.4.0
- feat: add inline style markup support in message text for ANSI text formatter output
- feat: support named color tags like `<red>...</>`, style tags like `<b>...</>`, and hex tags like `<#ff0000>...</>` / `<bg:#010203>...</>`
- feat: keep JSON formatter output unchanged and limit inline style parsing to text message rendering only
- feat: add `TextStyle`, `StyleTagRegistry`, `style_tag_registry()`, and `default_style_tag_registry()` for reusable inline style tags
- feat: add formatter-local `style_tags`, global style tag registry helpers, builtin-tag override support, and alias reuse via `define_alias(...)`
### Test
@@ -19,6 +21,7 @@ version 0.4.0
- test: cover config parsing and serialization for `color_mode`
- test: cover named inline color tags in ANSI mode
- test: cover plain mode tag stripping, nested tags, hex tags, and unknown-tag fallback behavior
- test: cover custom tags, builtin-tag override, formatter-vs-global priority, global registry fallback, and alias reuse
### Example
@@ -29,4 +32,4 @@ version 0.4.0
- `Auto` currently uses a conservative rule: if `NO_COLOR` exists, ANSI is disabled; otherwise ANSI is enabled
- inline style markup currently supports short close `</>` only
- unknown or invalid inline tags currently fall back to plain text and do not raise formatter errors
- tag registry override and configurable style aliases are planned for a later `0.4` batch
- formatter-local tag lookup currently takes precedence over global tag lookup, and global lookup takes precedence over builtin tags