Markdown mode editor toolbar doesn't have excise button: did I add it the right way?

I just discovered from Dave Gifford’s video on his subsume plugin that I’m missing a very important piece of the UI for editing tiddlers: The excise button.

It doesn’t show up for Markdown tiddlers.

So I added it by cloning $:/plugins/tiddlywiki/markdown/EditorToolbar/bold, renaming it to $:/plugins/tiddlywiki/markdown/EditorToolbar/excise and replacing all the fields with the stuff from $:/core/ui/EditorToolbar/excise. (Did the same for transcludify.)

Is this the right way to add a button to a plugin? I’m wondering what will happen to it when I upgrade the plugin … or TW itself, for that matter. Will it persist?

(BTW, these buttons work fine except they of course insert wikitext markup not markdown markup (for the excise via link, and transclude). I can live with that now, but I’ll work on it later I suppose.

(Though a feature request might be to add properly working excise and transcludify buttons to the Markdown plugin … why not? Seriously, why is the markdown plugin a second-class citizen?)

1 Like

Because markdown is not tiddlywiki syntax. … Just joking. There hasn’t been a request like this. I think it’s a good idea and it should be easy to implement it. The problem is,that markdown doesn’t have a syntax for transclusion. Linking is simple.

Transclusion works if you have the markdown plugin’s renderWikiText option true. (Though sometimes it does it inline and sometimes puts in newlines, haven’t figured that out yet.)

Basically, I want to use excise with either link or transclude. (I also want to do the subsume thing the same way, but I have to get to that.) The link option isn’t correct now - I can make it not put in the ** wrapper but then it will only work for a proper wiki title, it doesn’t know how to #-quotify a non-proper wiki title.

But anyway, I can live with these things, but I want to know if it will persist! Also I want to know what is the best way to package my little tweaks up so that I can more easily share them between TW files! Do I have to make them into a plugin? (Sounds heavy…)

It does persist. If you change plugin tiddlers they become system tiddlers. So even if you update the plugin, they will “win”. TW is designed to prioritize users content.

Super! Thanks! (fill to 20 chars minimum)

@david-bakin an additional problem comes with this; The newly created tiddlers (after excising) are not markdown tiddlers i.e. NOT of type=text/markdown; How do you do that? I would love any comment on that.

I think it might have to do with these lines in excise-dropdown

<$button>
<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="excise"
	title={{$config-title$/new-title}}
	type={{$config-title$/type}}
	macro={{$config-title$/macro-title}}
	tagnew={{$config-title$/tagnew}}
/>
<$action-deletetiddler
	$tiddler="$config-title$/new-title"
/>
<$action-deletetiddler
	$tiddler=<<dropdown-state>>
/>
<<lingo Caption/Excise>>
</$button>

Some other troubles I sorted –

  • another tiddler need to be defined and mentioned in transcludify tiddler – $:/plugins/tiddlywiki/markdown/EditorToolbar/excise-dropdown in order for excise button to even appear and work. After that I confirm that I can successfully excise in text/makrdown tiddlers.

    • condition field of $:/plugins/tiddlywiki/markdown/EditorToolbar/transcludify should be [<targetTiddler>!has[type]] [<targetTiddler>type[text/markdown]]

Rahul,

As I suspect you can see;

Just clone the excise button, and the dropdown tiddler it uses. Change the condition on the new one to only show on markdown tiddlers then modify your dropdown tiddler to do what you want.

  • Before deleting the new title use this to set the new tiddlers type to markdown.

Observation: The excise operation contains within it the ability to create new tiddlers, which I don’t think we document alongside tm-new-tiddler and actioncreatetiddler and of course if you use actionsetfield on a nnon-existent tiddler it also creates a new tiddler.

1 Like