HTML stripped from content when watch/replace, but not when written directly

I don’t know if this is a real bug. But Discourse is acting not so consistent, so? Basically this can be a feature/support/help-request too, so moderators/admins know what to do :wink:

It is easier to open what I was doing and what I got.

I was writing one running/training post and a term VO2max is boring to write. I could leave it like that, but it should be VO2max — I was using tag <sub></sub>

I love when things are easy and automated so I put it on watched list as simple VO2max and then it should replace with form VO<sub>2</sub>max.

You propably know what happened. Discourse changed it to form VO&lt;sub&gt;2&lt;/sub&gt;max. And that’s why the post looked that way:

But the excerpt showed tag as it should if HTML is allowed:

If/when Discourse will strip off HTML-tags should it happend everywhere, including excerps? Or does it come from topic preview, it is in use too.

And if excerpt can see pass coding, why a post can’t?

Actually, I don’t care if HTML-tags are showing or not depending are those here, there or everywhere :joy: but can we count situation where I can’t use HTML-tags with watch/replace, but I can use same tags directly at composer, as a bug? Because otherwise I’m off topic…

1 Like

I’m not sure watched words was designed to handle HTML… although you’re right that the inconsistency is a little weird.

As a workaround, instead of <sub>2</sub>, you could use a unicode subscript two: VO₂max. I suspect that will work much more reliably.

5 Likes

AFAIK a little bit difficult because I do most of my writings with iPad and Logitech keyboard — and difficult is in the meaning I know how to do that on my Win-laptop, but this small apple-style keyboard is quite demanding :wink:

I mean you could add a watched word which replaces

VO2max → VO₂max

Since there’s no HTML, I think watched words should work ok.

5 Likes

Good god I’m slow sometimes :man_facepalming:

Of course. Thanks. That fixes my real issue, rest is your headache…

3 Likes

It works perfectly!

At least 20 characters…

Well, that HTML-tag is really minor thing, but replace should allow everything that is… allowed. But there can be some technically limitations too. And that can be the reason why we have to use something like Linkify to add automatic linking?

shifting this to #feature, I agree there is a bit of a consistency issue here and we should probably call out better what happens.

I think the workaround by David gives us plenty of mileage though within the current constraints.

1 Like