@@ -71,6 +71,31 @@ impl File {
7171 . set_mime ( Some ( content_type. to_string ( ) ) ) ;
7272 }
7373 match content_type. as_str ( ) {
74+ "text/gemini" => {
75+ if matches ! ( * feature, Feature :: Source ) {
76+ load_contents_async ( file, cancellable, move |result| {
77+ match result {
78+ Ok ( data) => {
79+ Text :: Source ( uri, data) . handle ( & page)
80+ }
81+ Err ( message) => {
82+ Status :: Failure ( message) . handle ( & page)
83+ }
84+ }
85+ } )
86+ } else {
87+ load_contents_async ( file, cancellable, move |result| {
88+ match result {
89+ Ok ( data) => {
90+ Text :: Gemini ( uri, data) . handle ( & page)
91+ }
92+ Err ( message) => {
93+ Status :: Failure ( message) . handle ( & page)
94+ }
95+ }
96+ } )
97+ }
98+ }
7499 "text/plain" => {
75100 if matches ! ( * feature, Feature :: Source ) {
76101 load_contents_async ( file, cancellable, move |result| {
@@ -94,6 +119,18 @@ impl File {
94119 }
95120 }
96121 } ) ;
122+ } else if url. ends_with ( ".md" ) || url. ends_with ( ".markdown" )
123+ {
124+ load_contents_async ( file, cancellable, move |result| {
125+ match result {
126+ Ok ( data) => {
127+ Text :: Markdown ( uri, data) . handle ( & page)
128+ }
129+ Err ( message) => {
130+ Status :: Failure ( message) . handle ( & page)
131+ }
132+ }
133+ } )
97134 } else {
98135 load_contents_async ( file, cancellable, move |result| {
99136 match result {
@@ -107,6 +144,31 @@ impl File {
107144 } )
108145 }
109146 }
147+ "text/markdown" => {
148+ if matches ! ( * feature, Feature :: Source ) {
149+ load_contents_async ( file, cancellable, move |result| {
150+ match result {
151+ Ok ( data) => {
152+ Text :: Source ( uri, data) . handle ( & page)
153+ }
154+ Err ( message) => {
155+ Status :: Failure ( message) . handle ( & page)
156+ }
157+ }
158+ } )
159+ } else {
160+ load_contents_async ( file, cancellable, move |result| {
161+ match result {
162+ Ok ( data) => {
163+ Text :: Markdown ( uri, data) . handle ( & page)
164+ }
165+ Err ( message) => {
166+ Status :: Failure ( message) . handle ( & page)
167+ }
168+ }
169+ } )
170+ }
171+ }
110172 "image/png" | "image/gif" | "image/jpeg" | "image/webp" => {
111173 match gtk:: gdk:: Texture :: from_file ( & file) {
112174 Ok ( texture) => {
0 commit comments