mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-31 15:34:58 +00:00
📝 clarify formatter export docs
This commit is contained in:
@@ -40,6 +40,7 @@ Detailed rules explaining key parameters and behaviors
|
|||||||
- `pretty=false` returns compact JSON.
|
- `pretty=false` returns compact JSON.
|
||||||
- `pretty=true` returns indented JSON for humans.
|
- `pretty=true` returns indented JSON for humans.
|
||||||
- This helper is built on top of `text_formatter_config_to_json(...)`.
|
- This helper is built on top of `text_formatter_config_to_json(...)`.
|
||||||
|
- Internally it serializes the `JsonValue` result with `@json_parser.stringify(...)` or `@json_parser.stringify_pretty(value, 2)`, so the text form stays aligned with the structured formatter export helper.
|
||||||
- The output preserves the supported formatter config schema instead of any runtime-only formatter instance details.
|
- The output preserves the supported formatter config schema instead of any runtime-only formatter instance details.
|
||||||
|
|
||||||
### How to Use
|
### How to Use
|
||||||
@@ -73,3 +74,9 @@ e.g.:
|
|||||||
|
|
||||||
- If `style_tags` is empty, the serialized text omits that field rather than forcing an empty object.
|
- If `style_tags` is empty, the serialized text omits that field rather than forcing an empty object.
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
1. Use this helper when the next consumer expects JSON text instead of `JsonValue`.
|
||||||
|
|
||||||
|
2. Use `text_formatter_config_to_json(...)` when you still need to embed formatter config inside a larger JSON object before final stringification.
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ Detailed rules explaining key parameters and behaviors
|
|||||||
- The output includes visibility flags, separators, template, color settings, and markup settings.
|
- The output includes visibility flags, separators, template, color settings, and markup settings.
|
||||||
- `style_tags` is exported only when the map is not empty.
|
- `style_tags` is exported only when the map is not empty.
|
||||||
- Enum-like formatter options are serialized using their stable label strings.
|
- Enum-like formatter options are serialized using their stable label strings.
|
||||||
|
- `color_mode`, `color_support`, and the markup-mode fields are emitted through their label helpers, so the exported strings stay aligned with the parser-facing formatter config vocabulary.
|
||||||
|
- Nested `style_tags` entries are exported as plain JSON objects keyed by tag name, with each `TextStyle` rendered as structured config data rather than runtime registry state.
|
||||||
- The JSON shape matches the formatter section accepted by config parsing.
|
- The JSON shape matches the formatter section accepted by config parsing.
|
||||||
|
|
||||||
### How to Use
|
### How to Use
|
||||||
@@ -69,3 +71,9 @@ e.g.:
|
|||||||
|
|
||||||
- If callers need immediate text output rather than a JSON value, they should use `stringify_text_formatter_config(...)` instead.
|
- If callers need immediate text output rather than a JSON value, they should use `stringify_text_formatter_config(...)` instead.
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
1. Use this helper when you need a reusable JSON value rather than a final JSON string.
|
||||||
|
|
||||||
|
2. `sink_config_to_json(...)` reuses this helper for the nested `text_formatter` field.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user