TextBlaze removing double spaces needed for MarkDown and other formatting - read this, solved

for anyone having weird issues with TextBlaze snippets removing double spaces on insert (needed for formatting, e.g. Markdown): If you have any bold character in a comment, in your output or another snippet your own snippet loads, TextBlaze will reduce all spaces after a line break. Thanks @Gaurang_Tandon for solving this, see his answer below for the solution: https://community.blaze.today/t/textblaze-removing-double-spaces-needed-for-markdown-and-other-formatting-read-this-solved/36842/6?u=textblaze3

If this happens to you, jump to his solution. If you want to read all the details, you can start from here (my original post with the question):

it seems Textblaze removes any multiple spaces (at least I found multiple forum messages stating it does, but no solution on how to keep them). There is an issue with Markdown:
I have a tool returning text with Markdown formatting. Multiple spaces at the beginning of a line are used to indent it for sub-topics.

  • Textblaze removes the multiple spaces.

  • Alternatively, the tab-character can be used. But TextBlaze also seems to remove it.

  • It keeps underlines and &nspc - HTML-Syntax, but most Markdown-Tools don't understand that so I can't paste it.

If there was a solution to let Tool A return multiple underlines and replace them for Textblaze output, it would work. But again: Everything I try to output a double space or tab at the start of a line (if the clipboard contains the spaces/tabs at the start of a new line) fails.

Would could I do?


Hey, can you please share your Text Blaze snippet? To me it looks like you are copying text that was outputted by Tool A, and then including it in your Text Blaze snippet using the {clipboard} command, but I might be wrong. Having the Text Blaze snippet would help us understand the issue better :slightly_smiling_face:

1 Like

Thanks @Gaurang_Tandon ! Here is the part that shows the problem (I removed the other 40 lines to not overcomplicate things):

  1. I have a variable, cleantext, containg a long text (multiple paragraphs) with line breaks and leading white spaces. Two leading white spaces will create a sub item in structured lists (Markdown syntax), 4 leading white spaces a sub-sub item and so on.
  2. If I output the variable, all leading white spaces (after a line break) vanish.
  3. If I insert a formfield (formparagraph) and assign the content of the variable to it, all the leading spaces are perfectly in order, I can copy it to the clipboard from there and paste it in my target application
  4. But if I choose the "insert" button from textblaze, it will again strip all the leading spaces it showed in its own form field when it inserts the content from the formfield (see attached screenshot)

{key: ctrl-a; trim=yes}
{=cleantext; trim=yes}
{Result={=cleantext; format=}; trim=yes}
{formparagraph: name=Result; cols=40; rows=20; default=; trim=yes}

How can we stop this behavior and output whats's inside the variable without reformatting, or at least paste the formfield's content without stripping the spaces?
Textblaze removing leading white spaces

I think that behavior depends on the target website. I tried your snippet with this sample value:

{cleantext="1. Main item
  2. Sub item
    3. Sub sub item
Last line
"}{key: ctrl-a; trim=yes}
{=cleantext; trim=yes}
{Result={=cleantext; format=}; trim=yes}
{formparagraph: name=Result; cols=40; rows=20; default=; trim=yes}

and it works fine on the Text Blaze Dashboard as well as Gmail:


What is the name of the website on which you're trying this?

And can you try copying the text and directly pasting it into that target website? I feel like that even that would not work.

1 Like

Thanks! It's not the website, it doesn't even work in the Text Blaze Dashboard for the "try this" function. The screenshot I've attached is from there.
In the snippet it does not work if I output the variable but does work if I assign it to a form (paragraph), again see screenshot above.

If I place the cursor in the form with the output (see green check mark in the screenshot, before choosing "Insert"), press Ctrl+A and Ctrl+C and then paste it from the clipboard, it works perfectly fine in all target apps and websites. And I have this behaviour with other snippets, too — what should have saved time wasted several hours already.

My last idea to fix this is using this behaviour (copying frotm the formparagraph) as a workaround.
Is there any way to

  • Write to the Clipboard from a snippet
  • or let the snippet select the content of the formparagraph and simulate a CTRL+A & CTRL+C, effectively saving the content to the clipboard
  • or Assign a Hotkey to the Formparagraph (to move the cursor there), I could then use my Elgato Streamdeck (Hardware device emulating keystrokes) to select it with the hotkey, then press CTRL+A followed by CTRL + C and would then need a hotkey to close the snippet.

Any of those 3 ways would solve it since copy + paste from the formtext via clipboard works.

Okay, I think the problem is that there is styled text somewhere in the snippet (like bold text or a link). This results in the entire snippet being processed as HTML, and HTML can have issues in consecutive spaces.

The reason why it works when you copy from the formtext is because its completely plaintext.

If you don't need the HTML mode:

  1. select all contents in your snippet (press Ctrl+A or drag with mouse)
  2. clear all formatting by pressing the Tx button in the snippet editor toolbar.
  3. try the snippet again in your destination

Let me know if it works for you. Note if your snippet imports other snippets and those snippets have formatting, you'd need to clear their formats too.

If you need the HTML mode:

You can replace the regular space with a non-breaking space, like in this snippet:

{cleantext="1. Main item
  2. Sub item
    3. Sub sub item
Last line
"}{key: ctrl-a; trim=yes}
{=replace(cleantext, " ", " "); trim=yes}
---------------------------^ this space is a nbsp

If the forum messes up the nbsp, you can manually copy it from here:   U+00A0 NO-BREAK SPACE - Unicode Explorer
Let me know if it works for you.

Side note: in the future, if you get stuck on complex issues like these, please do not hesitate to eagerly email support@blaze.today so we can work on them in parallel (maybe on a call as well).


Thanks a lot! CTRL+A and Tx Button solved this, since some of my snippets had a link or reloaded a snippet with bold text.

Thanks a lot, I will do this in the future — it would have saved me several hours of searching the forum and trying it myself. It's great to know your team is there to have our backs!