Support named style closing tags

This commit is contained in:
Nanaloveyuki
2026-05-10 15:22:56 +08:00
parent e78183d267
commit 2d2388c79f
6 changed files with 77 additions and 4 deletions
+3 -1
View File
@@ -18,6 +18,7 @@ version 0.4.0
- feat: support `sink.text_formatter.style_markup` in JSON config parsing and serialization
- feat: add builtin semantic style tags such as `accent`, `info`, `success`, `warning`, `danger`, and `muted`
- feat: add independent `target_style_markup` and `fields_style_markup` controls for `TextFormatter` and `TextFormatterConfig`
- feat: support named closing tags like `</red>` alongside the existing short close `</>`
### Test
@@ -31,6 +32,7 @@ version 0.4.0
- test: cover disabled markup mode, builtin-only mode, and config-driven `style_markup` behavior
- test: cover builtin semantic tag rendering and confirm user overrides still take precedence
- test: cover target and field markup rendering, plus config roundtrip for the new formatter markup scopes
- test: cover named closing tags, mixed short/named closing, and unmatched named-close fallback behavior
### Example
@@ -41,7 +43,7 @@ version 0.4.0
### Notes
- `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
- inline style markup supports both short close `</>` and named closing tags like `</red>`
- 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