File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ pub enum FileType {
1515 TypeScript ,
1616 HTML ,
1717 CSS ,
18+ Dockerfile
1819 // Add more as needed
1920}
2021
@@ -43,6 +44,10 @@ impl SyntaxHighlighter {
4344 }
4445
4546 pub fn detect_file_type ( filename : & str ) -> FileType {
47+ if filename == "Dockerfile" {
48+ return FileType :: Dockerfile ;
49+ }
50+
4651 match Path :: new ( filename)
4752 . extension ( )
4853 . and_then ( OsStr :: to_str)
@@ -75,6 +80,7 @@ impl SyntaxHighlighter {
7580 FileType :: TypeScript => self . syntax_set . find_syntax_by_extension ( "ts" ) . unwrap_or_else ( || self . syntax_set . find_syntax_plain_text ( ) ) ,
7681 FileType :: HTML => self . syntax_set . find_syntax_by_extension ( "html" ) . unwrap_or_else ( || self . syntax_set . find_syntax_plain_text ( ) ) ,
7782 FileType :: CSS => self . syntax_set . find_syntax_by_extension ( "css" ) . unwrap_or_else ( || self . syntax_set . find_syntax_plain_text ( ) ) ,
83+ FileType :: Dockerfile => self . syntax_set . find_syntax_by_extension ( "Dockerfile" ) . unwrap_or_else ( || self . syntax_set . find_syntax_plain_text ( ) ) ,
7884 } ;
7985
8086 // Perform highlighting
You can’t perform that action at this time.
0 commit comments