How to make text/markdown the default tiddler type?

Is there a way to set the default type of a tiddler to text/markdown? I do the vast majority of my editing in markdown and I have to remember to manually change the type to text/markdown every time. Often I forget, then things start to look funny in the preview, I have to interrupt what I’m doing, scroll down, change the type…

I studied the settings and did not find any default type.

I tried creating a tiddler titled $:/config/NewTiddler/Type with content text/markdown, but it did not have any effect.

Then I looked at this thread](How do I make the "click edit to create" button make a markdown tiddler?), which referred to $action-createtiddler as being responsible for creating a new tiddler and setting its type and thought I could hack it, but I can’t find its definition.

Help appreciated…

I recommend changing button to custom one. This is best path, imo

Okay, now i got time for real help.

First of all, button that you need is in $:/core/ui/Buttons/new-tiddler. You can replace actions attribute to suit your needs or duplicate button (which i recommend, but we can go with simpler solution).

Lets choose to edit default action. Go to $:/core/ui/Actions/new-tiddler and add to $action-sendmessage your type:

<$action-sendmessage $message="tm-new-tiddler" tags=<<get-tags>> type="text/markdown"/>

I dont see text/markdown in list of types in my wiki, but i trust you that its right.

2 Likes

Hi @Mirokko,
Thanks for your help.
Unfortunately there is no $:/core/ui/Actions in my installation. Here are all the core/ui tiddlers thatshow up in the advanced search:
image

I could not find the definition of the needed action in there.

1 Like

Never mind, I found it. It is a shadow tiddler inside $:/core, that’s why it didn’t show up in the search

There’s an option that doesn’t involve any wikitext hacking, though it doesn’t literally and directly answer your question, so feel free to skip the rest of my answer if you feel this is an Y-X Problem.

When you enable the vanilla Markdown plugin and go to the Tools tab, you get the option to enable a new Markdown tiddler in the main toolbar. This doesn’t replace the default new tiddler button, it just adds one more next to it, which you click when you need to create a Markdown tiddler. It opens the Draft of the new tiddler with the correct tiddler type field pre-filled.

Thanks @vuk, indeed I found about it myself after having made a new action, new button, and new icon

I can always tell myself I learn something new today…

If you have wikis with many Markdown tiddlers, but not just Markdown tiddlers, you may find this useful as well: How to visualize the content type of a tiddler?