| 1 | // Package format provides utilities for formatting, parsing, and rendering notification service |
| 2 | // configurations in the shoutrrr library. |
| 3 | // |
| 4 | // This package handles various aspects of service configuration management: |
| 5 | // |
| 6 | // # Query String Handling |
| 7 | // |
| 8 | // The package provides functions for building and parsing URL query strings that represent |
| 9 | // service configurations. It supports custom fields that can be escaped to avoid conflicts |
| 10 | // with built-in configuration properties using the "__" prefix. |
| 11 | // |
| 12 | // Key functions: |
| 13 | // - BuildQuery: Converts a config object to a query string |
| 14 | // - BuildQueryWithCustomFields: Builds a query with custom fields, escaping conflicting keys |
| 15 | // - SetConfigPropsFromQuery: Sets config properties from query string values |
| 16 | // - EscapeKey/UnescapeKey: Escapes/unescapes keys that conflict with config props |
| 17 | // |
| 18 | // # Configuration Formatting |
| 19 | // |
| 20 | // The package includes comprehensive support for parsing and formatting various field types |
| 21 | // found in service configurations: |
| 22 | // |
| 23 | // - Basic types: strings, integers, booleans |
| 24 | // - Complex types: maps, slices, arrays, structs |
| 25 | // - Enum types: enumerated values with named options |
| 26 | // |
| 27 | // Key functions: |
| 28 | // - ParseBool/PrintBool: Parse and print boolean values |
| 29 | // - IsNumber: Check if a string represents a number |
| 30 | // - SetConfigField: Set a config field from a string value |
| 31 | // - GetConfigFieldString: Get string representation of a config field |
| 32 | // - GetConfigFormat: Get type and field information from a service config |
| 33 | // |
| 34 | // # Format Conversion |
| 35 | // |
| 36 | // The package provides conversion between text, markdown, and HTML formats: |
| 37 | // |
| 38 | // - markdown ↔ text |
| 39 | // - html ↔ text |
| 40 | // - text ↔ markdown |
| 41 | // - text ↔ html |
| 42 | // - markdown ↔ html |
| 43 | // |
| 44 | // Key functions: |
| 45 | // - ConvertFormat: Convert between any supported formats |
| 46 | // |
| 47 | // # Property Serialization |
| 48 | // |
| 49 | // The package provides serialization/deserialization support for configuration properties |
| 50 | // that implement the ConfigProp interface: |
| 51 | // |
| 52 | // Key functions: |
| 53 | // - GetConfigPropFromString: Deserialize a config property from a string |
| 54 | // - GetConfigPropString: Serialize a config property to a string |
| 55 | // |
| 56 | // # Output Rendering |
| 57 | // |
| 58 | // The package supports multiple output formats for displaying configuration trees: |
| 59 | // |
| 60 | // - Console output with color highlighting |
| 61 | // - Markdown output for documentation |
| 62 | // - Tree-based hierarchical display |
| 63 | // |
| 64 | // Key functions: |
| 65 | // - ColorFormatTree: Generate color-highlighted tree output |
| 66 | // - ConsoleTreeRenderer: Render configuration as console-friendly tree |
| 67 | // - MarkdownTreeRenderer: Render configuration as markdown |
| 68 | // |
| 69 | // # Key Concepts |
| 70 | // |
| 71 | // KeyPrefix ("__"): Prefix used to escape custom URL query keys that would otherwise |
| 72 | // conflict with built-in service configuration property names. |
| 73 | // |
| 74 | // ConfigQueryResolver: Interface for objects that can provide and accept configuration |
| 75 | // through query string parameters. |
| 76 | // |
| 77 | // ContainerNode: Tree node structure representing configuration hierarchies. |
| 78 | // |
| 79 | // FieldInfo: Metadata about configuration fields including type, constraints, and |
| 80 | // formatting information. |
| 81 | // |
| 82 | // EnumFormatter: Interface for handling enumerated configuration values with |
| 83 | // named options. |
| 84 | package format |