Editor toolbar button to remove extra space and line breaks

@etardiff I was trying to use the no space editor toolbar button you shared in discord. I have a doubt.

Here is a tiddler I clipped using tiddlyclip

I wanted to remove the extra spaces between the lines and I tried using the no space button you shared.
The output looks like this.

But I want it to be like this.

Is it possible??

1 Like

Probably… though I wrote the button specifically to eliminate the kind of line breaks you’re getting in your desired editor output, since they’re not preserved in the rendered text anyway.

May I ask how you intend to use this? Isn’t it a lot harder to read when the tiddler is in view mode?

I want to add bullet formatting after removing the extra space.

This is not easy with the current no space button.

Try replacing the button’s text field with the following:

<$vars storeTitle=<<qualify "$:/temp/storeText">>>
<$action-deletetiddler $filter="[<storeTitle>]" />
<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="save-selection"
	 tiddler=<<storeTitle>> field="text" />
<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="replace-selection"
	 text={{{ [<storeTitle>get[text]search-replace:g:regexp[(\n)(\n+)],[$1]search-replace:g:regexp[\ +],[ ]] }}} />
</$vars>
2 Likes

That works perfectly. Thank you @etardiff . This will definitely be a time saver.

In a related requirement which could “improve” the number and bullet buttons is to only apply the bullet to lines that are not blank. In many cases when viewed the empty lines dont show.

Do you think it would be easy to rework your solution to do this @etardif ?

No, not really—not that it would necessarily be difficult, but it’s really nothing to do with blank space removal at that point. I’d start by cloning the existing unordered list button and going from there.

1 Like