\t becomes a tab character in HTML

It should be untouched text. Only in JS does \t etc. are escaped. So \t becomes a tab character instead of just the text \t.

As seen here: https://perchance.org/slash-t-in-textarea-43534#edit

3 points · 3 comments · view on lemmy.world

3 Comments

wthit56@lemmy.world · 1 pts · 1y
perchance@lemmy.world · 1 pts · 1y (1 reply)

Hmm, I thought this was an easy fix, but I just reverted the changes because there are some potential complications and back-compat issues. I think we may have to treat all HTML text as if it were "Perchance item text" for now - at least until an overhaul/V2.

The crux of the complication is that in Perchance, text can be affected other text around it - like {a}, so my original solution of "just handle bracket escaping, and not \t, \n, etc." has some subtle edge cases where behavior is different than what you might expect.

So then I thought, okay, I'll just do this for text nodes that don't contain any square/curly blocks. I.e. just remove the backslashes from escaped curly/square brackets, and don't process stuff like \t. But then we have potentially counter-intuitive discontinuity in behavior. I.e. you take away a square block from some text in the HTML, and you get a bunch of other thing changing (e.g. newlines in a pre element) as a result.

So I think this needs some more thought... I've added to perchance.org/known-bugs for now - if you have any thoughts please let me know. Thanks!

wthit56@lemmy.world · 2 pts · 1y

Okay understood. Thanks for looking into this for me 👍