Add formatter style_tags config support

This commit is contained in:
Nanaloveyuki
2026-05-10 15:00:37 +08:00
parent f1b223f203
commit f3e903b578
6 changed files with 203 additions and 6 deletions
+4
View File
@@ -13,6 +13,7 @@ version 0.4.0
- 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(...)`
- feat: support minimal `sink.text_formatter.style_tags` JSON config parsing and serialization for custom formatter tag styles
### Test
@@ -22,10 +23,12 @@ version 0.4.0
- 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
- test: cover formatter `style_tags` JSON parsing, config roundtrip, JSON helper export, and config-driven styled formatter rendering
### Example
- docs: add `color_mode` usage examples to formatter documentation
- docs: add runtime and JSON `style_tags` examples, and document current JSON schema scope
### Notes
@@ -33,3 +36,4 @@ version 0.4.0
- 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
- formatter-local tag lookup currently takes precedence over global tag lookup, and global lookup takes precedence over builtin tags
- JSON config currently supports concrete style objects only; alias-style declarations remain runtime-only