How do I make the "click edit to create" button make a markdown tiddler?

I use Markdown exclusively. I’ve added a “new Markdown tiddler”[^1] button to the sidebar, no problem there. But how do I change the “click edit to create” button to make a Markdown tiddler? (Currently it is making a new tiddler with an empty content type.) (TW 5.1.23)

[^1]: When you use a wikilink in a tiddler that hasn’t been created yet, and then you click on it, and you get a “missing tiddler” tiddler - and it has a button which is the “click edit to create” button.

Have a look at the right sidebar: Tools -tab There should be a Page button, that can be activated. You can also deactivate the default button

I don’t see a “Page” button. There was a “new tiddler” button which I unchecked because I added a “new Markdown tiddler” button which is all I use.

I’m talking about when you’re not using the sidebar, but instead you’re just writing/editing a tiddler when you type in a new tiddler name that doesn’t exist yet. Then you click on that name and get a empty new tiddler ready to go (except it has the correct name already). Instead of any actual content it has this “click edit to create” button. That’s what I want to change the behavior of.

It has this behavior because that is the behavior of Edit button. So you need create a new button which also set the field Type to a markdown and then you change it in $:/language/MissingTiddler/Hint

David,

See this thread and my answer is about how you treat missing tiddlers.

The edit button works by sending tm-edit-tiddler. But that message is defined to replace the current tiddler and it takes only a title as parameter. Unlike tm-new-tiddler which can also take additional fields, like type.

So I don’t know how to send the type over. I’m already way beyond my understanding - and I have to say, tiddlywiki.com is definitely not helpful. (See below.) So I’d still appreciate some actual code in addition to saying “do this, do that”. I know people try to be helpful with other TW beginners - but you have to make an allowance, I hope, for real lack of knowledge and no way to get it (see below). (I’ve already spent a couple of hours on this.)

Here’s my example of how tiddlywiki.com isn’t helpful to me today. Alvaro above advises me to “create a new button”. So I go to tiddlywiki.com and find a helpful tutorial tiddler: “Making a custom journal button”.

First thing it says is “start by cloning the New Journal button” which is harder than you think because “clone” is hidden on the dropdown in the “more” dropdown on the tiddler button bar, and a search in tiddlywiki.com for “clone” turns up nothing relevant at all. But if you finally remember to look at “more” and find the clone command then it tells you to do a search/replace on certain code you’ll see there in your clone. Except: Apparently it is talking about some older version of TW because the code you’re looking at doesn’t look anything like what it is suggesting.

The tiddler “Messages” is simply a list of messages - no indication of how to use them. And same for all of the individual message tiddlers, e.g., “tm-edit-tiddler” has no example.

And since “tm-edit-tiddler” claims to replace the tiddler you’re pressing the button in (this is the missing tiddler scenario) how exactly is it going to work to set the field in it unless you can send a message - which doesn’t seem to exist (there’s no “set field”, only an “add field”.)

Etc. etc. Raised far more questions than answers, I’m sorry to say.

So, in conclusion, I’d really appreciate your help. This must be simple - yet, impossible to discover how.

Put the following in a tiddler and tag it with “$:/tags/ViewTemplate”

\define newMarkdown()
    <$action-sendmessage
        $message="tm-new-tiddler"
        title=<<currentTiddler>>
        type="text/x-markdown"
        tags="YourTag"
       />
\end
<$list filter="[all[current]is[missing]!is[shadow]]" variable=nul>

or click 
<$button class=<<tv-config-toolbar-class>> selectedClass="tc-selected" tooltip="New Markdown" actions=<<newMarkdown>>>
  {{$:/plugins/tiddlywiki/markdown/images/new-markdown-button}}
</$button>
to make New Markdown Tiddler.
</$list>

Now an additional button and message will appear at the bottom of a missing tiddler allowing you to make a new Markdown Tiddler with the target name.

I think you will be able to see how to specify your own tags and additional fields.

I put this together from the other prior posts by Tony and deshmukh, just adding in the missing bits.

HTH
Mark

Thank you Mark, but I’ve done that! I have a “new markdown tiddler” button for a toolbar - it comes with the markdown plugin. But you’re sending the message “tm-new-tiddler”, which, if you use it from a “missing tiddler” - that is you clicked on a missing tiddler’s link, you get a tiddler which says “click EDIT to create this tiddler” ← where EDIT is a button - then that button uses “tm-edit-tiddler” which replaces the missing tiddler where if you use “tm-new-tiddler” there it opens up a new tiddler to edit, then you’ve got the “missing” one still there …

And (according to the documentation) “tm-edit-tiddler” doesn’t take a “type” parameter (or a bag-of-fields parameter) …

David, It can be a common problem on the tiddlyiki forums that we have so many different experience levels. Then some advanced users do not know anything about a specific method. For regular responders such as myself, mark, mario and Eric it is easier for us to respond to people at a mid level of understanding and later adjust as the users level becomes more apparent. Feel free to ask questions which indicate your limited knowledge, we all have to start some where.

My time is somewhat limited but let me make these points

  • The actioncreatetiddler widget is the more comprehensive way to make tiddlers
  • Using the messages such as tm-edit-tiddler are simplified, look further for more appropriate actions.
  • If a tiddler already exists changing particular fields uses the various field actions.
    • You can use this to set the Type field if not included in the actionCreate Tiddler.
    • or in actioncreate tiddler type=“text/x-markdown”
  • Following a link to a missing tidder, although you see it, it is not created until you edit it, or click the button to create it.
  • When creating a tiddler you may still need to navigate to it to see it (see action navigate)

Regards

TW - ok, now that’s actually good help, thank you! I’ll look at the action create tiddler - I didn’t know that “messages” are simplified actions - in fact, “messages” aren’t describe in tiddlywiki.com!

I also look straight in the repo for code too (though I don’t build TW myself).

Thanks!

“messages” aren’t describe in tiddlywiki.com!

They are really, even if the documentation could be better. Put “messages” into the search and look at the list.

Also search for “Action” to see related documentation

I’m sorry I misunderstood this

I think that you have the level to create a button.

I try how I tell you, but It doesn’t work.

I don’t know what you’re saying or what you want. I thought you were concerned about the situation where if you click on a missing tiddler link, you can’t then make a new markdown tiddler with the same name as the missing link. The code I provided will do that. An additional button appears which allows you to create the missing tiddler as a markdown. The tiddler is created open for editing, which is usually the first thing you want to do.

If you didn’t try the code, you might have assumed it was no different than your existing code. When the new tiddler is created with the markdown button I provided, the existing (non-existent) tiddler is over-written and is open for editing. So you don’t need tm-edit-tiddler.

It works…
I think that I tried it in wrong place. I did in tiddlywiki without markdown plugin. :man_facepalming:

Create a tiddler with this test field

\whitespace trim
<$button message="tm-edit-tiddler" tooltip={{$:/language/Buttons/Edit/Hint}} aria-label={{$:/language/Buttons/Edit/Caption}} class=<<tv-config-toolbar-class>>>
<$action-setfield type="text/x-markdown"/>
{{$:/core/images/edit-button}}
</$button>

In tiddler $:/language/MissingTiddler/Hint in text field in {{||$:/core/ui/Buttons/edit}} you have to change $:/core/ui/Buttons/edit for the title of your tiddler