Skip to content

Commit de02bc7

Browse files
committed
Document and expose diffFileHeaders in README and builder
1 parent acd6efd commit de02bc7

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ For reusable configurations:
121121
let codeReviewConfig = DiffConfiguration(
122122
theme: .light,
123123
showLineNumbers: true,
124+
showFileHeaders: true,
124125
fontSize: 13,
125126
fontWeight: .regular,
126127
lineSpacing: .comfortable,
@@ -201,6 +202,7 @@ struct PullRequestView: View {
201202

202203
- `.diffTheme(_ theme: DiffTheme)` - Apply a color theme
203204
- `.diffLineNumbers(_ show: Bool)` - Toggle line numbers
205+
- `.diffFileHeaders(_ show: Bool)` - Toggle file headers
204206
- `.diffFont(size: CGFloat?, weight: Font.Weight?, design: Font.Design?)` - Configure font
205207
- `.diffLineSpacing(_ spacing: LineSpacing)` - Set line spacing
206208
- `.diffWordWrap(_ wrap: Bool)` - Enable word wrapping

Sources/gitdiff/DiffConfigurationBuilder.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,22 @@ public extension DiffConfiguration {
6666
)
6767
}
6868

69+
/// Creates a new configuration with file headers toggled
70+
func withFileHeaders(_ show: Bool) -> DiffConfiguration {
71+
DiffConfiguration(
72+
theme: theme,
73+
showLineNumbers: showLineNumbers,
74+
showFileHeaders: show,
75+
fontFamily: fontFamily,
76+
fontSize: fontSize,
77+
fontWeight: fontWeight,
78+
lineHeight: lineHeight,
79+
lineSpacing: lineSpacing,
80+
wordWrap: wordWrap,
81+
contentPadding: contentPadding
82+
)
83+
}
84+
6985
/// Creates a new configuration with word wrap toggled
7086
func withWordWrap(_ wrap: Bool) -> DiffConfiguration {
7187
DiffConfiguration(

0 commit comments

Comments
 (0)