File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,21 @@ local function open_by_os(args)
107107 return vim .fn .system (cmd )
108108end
109109
110+ -- Normalise the filetype
111+ --- @param ft string
112+ --- @return string
113+ local function normalise_ft (ft )
114+ -- TODO: add proper nested language support
115+ -- https://github.com/charmbracelet/freeze/pull/79
116+ if ft == " typescriptreact" then
117+ return " typescript"
118+ elseif ft == " markdown.mdx" then
119+ return " markdown"
120+ end
121+
122+ return ft
123+ end
124+
110125-- Open the generated image
111126--- @param args FreezeOptions
112127M .open = function (args )
@@ -208,7 +223,8 @@ M.start = function(args, options)
208223 elseif options .language then
209224 table.insert (cmd , options .language )
210225 else
211- table.insert (cmd , vim .bo .filetype )
226+ local ft = normalise_ft (vim .bo .filetype )
227+ table.insert (cmd , ft )
212228 end
213229
214230 -- Run the command and get the output
You can’t perform that action at this time.
0 commit comments