Skip to content

Commit 07fea4f

Browse files
committed
docs: update documentation comments to Swift style
- Replace @default JavaScript-style comments with Swift's - Default: format - Use backticks around default values for better readability - Improve Xcode Quick Help compatibility and DocC support - All default values now follow Swift documentation conventions This change makes the documentation more consistent with Swift standards and provides better IDE integration.
1 parent 414c97b commit 07fea4f

2 files changed

Lines changed: 35 additions & 35 deletions

File tree

Sources/HTMLMinifier/HTMLMinifierOptions.swift

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,142 +11,142 @@
1111
public struct HTMLMinifierOptions: Sendable {
1212

1313
/// Treat attributes in case sensitive manner (useful for custom HTML tags)
14-
/// @default false
14+
/// - Default: `false`
1515
public var caseSensitive: Bool
1616

1717
/// Omit attribute values from boolean attributes
18-
/// @default false
18+
/// - Default: `false`
1919
public var collapseBooleanAttributes: Bool
2020

2121
/// Don't leave any spaces between `display:inline;` elements when collapsing.
2222
/// Must be used in conjunction with `collapseWhitespace=true`
23-
/// @default false
23+
/// - Default: `false`
2424
public var collapseInlineTagWhitespace: Bool
2525

2626
/// Collapse white space that contributes to text nodes in a document tree
27-
/// @default false
27+
/// - Default: `false`
2828
public var collapseWhitespace: Bool
2929

3030
/// Always collapse to 1 space (never remove it entirely).
3131
/// Must be used in conjunction with `collapseWhitespace=true`
32-
/// @default false
32+
/// - Default: `false`
3333
public var conservativeCollapse: Bool
3434

3535
/// Handle parse errors instead of aborting
36-
/// @default false
36+
/// - Default: `false`
3737
public var continueOnParseError: Bool
3838

3939
/// Use direct Unicode characters whenever possible
40-
/// @default false
40+
/// - Default: `false`
4141
public var decodeEntities: Bool
4242

4343
/// Parse input according to HTML5 specifications
44-
/// @default true
44+
/// - Default: `true`
4545
public var html5: Bool
4646

4747
/// Insert tags generated by HTML parser
48-
/// @default true
48+
/// - Default: `true`
4949
public var includeAutoGeneratedTags: Bool
5050

5151
/// Keep the trailing slash on singleton elements
52-
/// @default false
52+
/// - Default: `false`
5353
public var keepClosingSlash: Bool
5454

5555
/// Maximum input length to prevent ReDoS attacks (disabled by default)
56-
/// @default nil
56+
/// - Default: `nil`
5757
public var maxInputLength: Int?
5858

5959
/// Specify a maximum line length.
6060
/// Compressed output will be split by newlines at valid HTML split-points
61-
/// @default nil
61+
/// - Default: `nil`
6262
public var maxLineLength: Int?
6363

6464
/// Minify CSS in style elements and style attributes
65-
/// @default false
65+
/// - Default: `false`
6666
public var minifyCSS: Bool
6767

6868
/// Minify JavaScript in script elements and event attributes
69-
/// @default false
69+
/// - Default: `false`
7070
public var minifyJS: Bool
7171

7272
/// Minify URLs in various attributes
73-
/// @default false
73+
/// - Default: `false`
7474
public var minifyURLs: Bool
7575

7676
/// Never add a newline before a tag that closes an element
77-
/// @default false
77+
/// - Default: `false`
7878
public var noNewlinesBeforeTagClose: Bool
7979

8080
/// Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.
8181
/// Must be used in conjunction with `collapseWhitespace=true`
82-
/// @default false
82+
/// - Default: `false`
8383
public var preserveLineBreaks: Bool
8484

8585
/// Prevents the escaping of the values of attributes
86-
/// @default false
86+
/// - Default: `false`
8787
public var preventAttributesEscaping: Bool
8888

8989
/// Process contents of conditional comments through minifier
90-
/// @default false
90+
/// - Default: `false`
9191
public var processConditionalComments: Bool
9292

9393
/// Type of quote to use for attribute values ("'" or """)
94-
/// @default nil
94+
/// - Default: `nil`
9595
public var quoteCharacter: String?
9696

9797
/// Remove quotes around attributes when possible
98-
/// @default false
98+
/// - Default: `false`
9999
public var removeAttributeQuotes: Bool
100100

101101
/// Strip HTML comments
102-
/// @default false
102+
/// - Default: `false`
103103
public var removeComments: Bool
104104

105105
/// Remove all attributes with whitespace-only values
106-
/// @default false
106+
/// - Default: `false`
107107
public var removeEmptyAttributes: Bool
108108

109109
/// Remove all elements with empty contents
110-
/// @default false
110+
/// - Default: `false`
111111
public var removeEmptyElements: Bool
112112

113113
/// Remove optional tags
114-
/// @default false
114+
/// - Default: `false`
115115
public var removeOptionalTags: Bool
116116

117117
/// Remove attributes when value matches default
118-
/// @default false
118+
/// - Default: `false`
119119
public var removeRedundantAttributes: Bool
120120

121121
/// Remove `type="text/javascript"` from `script` tags.
122122
/// Other `type` attribute values are left intact
123-
/// @default false
123+
/// - Default: `false`
124124
public var removeScriptTypeAttributes: Bool
125125

126126
/// Remove `type="text/css"` from `style` and `link` tags.
127127
/// Other `type` attribute values are left intact
128-
/// @default false
128+
/// - Default: `false`
129129
public var removeStyleLinkTypeAttributes: Bool
130130

131131
/// Remove space between attributes whenever possible.
132132
/// **Note that this will result in invalid HTML!**
133-
/// @default false
133+
/// - Default: `false`
134134
public var removeTagWhitespace: Bool
135135

136136
/// Sort attributes by frequency
137-
/// @default false
137+
/// - Default: `false`
138138
public var sortAttributes: Bool
139139

140140
/// Sort style classes by frequency
141-
/// @default false
141+
/// - Default: `false`
142142
public var sortClassName: Bool
143143

144144
/// Trim white space around `ignoreCustomFragments`
145-
/// @default false
145+
/// - Default: `false`
146146
public var trimCustomFragments: Bool
147147

148148
/// Replaces the `doctype` with the short (HTML5) doctype
149-
/// @default false
149+
/// - Default: `false`
150150
public var useShortDoctype: Bool
151151

152152
public init(

Tests/HTMLMinifierTests/HTMLMinifierTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func collapseWhitespace() throws {
3737
@Test("Default options minification")
3838
func defaultMinification() throws {
3939
let html = #"<p title="test"> Hello World </p><!-- comment -->"#
40-
let result = try HTMLMinifier.minify(html)
41-
40+
let option: HTMLMinifierOptions = .init(removeComments: true)
41+
let result = try HTMLMinifier.minify(html, options: option)
4242
// Should remove comments, collapse whitespace, etc. based on default options
4343
#expect(result.contains("Hello World"))
4444
#expect(!result.contains("comment"))

0 commit comments

Comments
 (0)