Your comments

You need to escape each backslash. To find one backslash, enter \\. To find three backslashes enter \\\\\\ (6 backslashes). 

That is because you can search for \t to find tabs and \n to find newlines. 

The problem may be that the title bar only allows you to change the file name, not the file extension/type. That’s a limitation of the macOS document system.

Use File -> Save instead. 

Thanks for the video.

What happens when you use Cmd-S or File -> Save instead of renaming using the title bar?

In the save sheet, when saving an untitled file, you should be able to change the file extension from "txt" to "md". I just tried this out and it works for me.

I'd recommend the following: after creating a new file in Textastic, immediately change the syntax definition from Plain Text to e.g. Markdown (in the bottom bar). Then, when you enter text and save the file, Textastic should automatically suggest .md as the file extension.

Maybe you can copy it as text, create a new file using the + button in Textastic and paste it. 

Or tell Gemini to provide the code as a text file you can open in a code editor like Textastic. 

Hello,

the screenshot is not from the code editor of Textastic. It looks like the preview of a PDF?

This should probably be disabled for Markdown for example, because trailing whitespace has meaning in Markdown: two spaces at the end of a line insert a <br> tag. (see https://spec.commonmark.org/0.31.2/#hard-line-breaks)

So maybe, it's better to have a list of file extensions for which this feature would be enabled? Similar to the existing Settings -> New File -> Preferred File Extensions.

Are there any settings you would like to see for this feature? Or just enabled/disable?

Good point, trimming trailing whitespace on save would really be helpful.