@@ -9,8 +9,11 @@ use biome_html_syntax::{HtmlFileSource, HtmlLanguage};
99
1010use crate :: comments:: { FormatHtmlComment , HtmlCommentStyle , HtmlComments } ;
1111
12- #[ derive( Debug , Clone , Default ) ]
12+ #[ derive( Debug , Clone ) ]
1313pub struct HtmlFormatOptions {
14+ /// The file source.
15+ file_source : HtmlFileSource ,
16+
1417 /// The indent style.
1518 indent_style : IndentStyle ,
1619
@@ -46,13 +49,35 @@ pub struct HtmlFormatOptions {
4649 self_close_void_elements : SelfCloseVoidElements ,
4750}
4851
52+ impl Default for HtmlFormatOptions {
53+ fn default ( ) -> Self {
54+ Self {
55+ file_source : HtmlFileSource :: html ( ) ,
56+ indent_style : IndentStyle :: default ( ) ,
57+ indent_width : IndentWidth :: default ( ) ,
58+ line_ending : LineEnding :: default ( ) ,
59+ line_width : LineWidth :: default ( ) ,
60+ attribute_position : AttributePosition :: default ( ) ,
61+ bracket_same_line : BracketSameLine :: default ( ) ,
62+ whitespace_sensitivity : WhitespaceSensitivity :: default ( ) ,
63+ indent_script_and_style : IndentScriptAndStyle :: default ( ) ,
64+ self_close_void_elements : SelfCloseVoidElements :: default ( ) ,
65+ }
66+ }
67+ }
68+
4969impl HtmlFormatOptions {
50- pub fn new ( _file_source : HtmlFileSource ) -> Self {
70+ pub fn new ( file_source : HtmlFileSource ) -> Self {
5171 Self {
72+ file_source,
5273 ..Default :: default ( )
5374 }
5475 }
5576
77+ pub fn file_source ( & self ) -> & HtmlFileSource {
78+ & self . file_source
79+ }
80+
5681 pub fn with_indent_style ( mut self , indent_style : IndentStyle ) -> Self {
5782 self . indent_style = indent_style;
5883 self
0 commit comments