Debian Codegraph @

pkg/format/doc.go

raw
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 // - Duration types: [time.Duration], parsed and rendered with Go duration syntax
25 // (e.g. "10s", "1h2m3s"). Bare, non-zero numbers are rejected; however, "0" is
26 // accepted as the zero duration
27 // - Complex types: maps, slices, arrays, structs
28 // - Enum types: enumerated values with named options
29 //
30 // Key functions:
31 // - ParseBool/PrintBool: Parse and print boolean values
32 // - IsNumber: Check if a string represents a number
33 // - SetConfigField: Set a config field from a string value
34 // - GetConfigFieldString: Get string representation of a config field
35 // - GetConfigFormat: Get type and field information from a service config
36 //
37 // # Format Conversion
38 //
39 // The package provides conversion between text, markdown, and HTML formats:
40 //
41 // - markdown ↔ text
42 // - html ↔ text
43 // - text ↔ markdown
44 // - text ↔ html
45 // - markdown ↔ html
46 //
47 // Key functions:
48 // - ConvertFormat: Convert between any supported formats
49 //
50 // # Property Serialization
51 //
52 // The package provides serialization/deserialization support for configuration properties
53 // that implement the ConfigProp interface:
54 //
55 // Key functions:
56 // - GetConfigPropFromString: Deserialize a config property from a string
57 // - GetConfigPropString: Serialize a config property to a string
58 //
59 // # Output Rendering
60 //
61 // The package supports multiple output formats for displaying configuration trees:
62 //
63 // - Console output with color highlighting
64 // - Markdown output for documentation
65 // - Tree-based hierarchical display
66 //
67 // Key functions:
68 // - ColorFormatTree: Generate color-highlighted tree output
69 // - ConsoleTreeRenderer: Render configuration as console-friendly tree
70 // - MarkdownTreeRenderer: Render configuration as markdown
71 //
72 // # Key Concepts
73 //
74 // KeyPrefix ("__"): Prefix used to escape custom URL query keys that would otherwise
75 // conflict with built-in service configuration property names.
76 //
77 // ConfigQueryResolver: Interface for objects that can provide and accept configuration
78 // through query string parameters.
79 //
80 // ContainerNode: Tree node structure representing configuration hierarchies.
81 //
82 // FieldInfo: Metadata about configuration fields including type, constraints, and
83 // formatting information.
84 //
85 // EnumFormatter: Interface for handling enumerated configuration values with
86 // named options.
87 package format