News:

Wondering if this will always be free?  See why free is better.

Main Menu

Hiding Unsupported HTML Tags?

Started by Heatherlly, February 12, 2019, 01:59:07 AM

Previous topic - Next topic

Heatherlly

Hi! I've enabled basic HTML for my users, but I'd like to know how to hide unsupported tags.

For example, if someone posts:

Quote<p>Sample text.</p>

I'd just like it to show:

QuoteSample text.

This is an important modification for my site, as quite a few users will be copying and pasting text from another site. All the other HTML tags are supported, but the paragraph tag is problematic.

NOTE: I initially added it to the list of supported tags for basic HTML, but it creates too much extra spacing. Seems more practical just to strip/hide it.

Any help you can give me would be great. Thank you!

Aleksi "Lex" Kilpinen

Adding spacing is part of what p is supposed to do, the browser adds margin automatically before and after the <p> element.
If you wish to support it, adding it to the supported tags is IMO the easier route - to strip it away, would require you to parse it out of the messages ( like handling BBC ).
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Heatherlly

Thanks so much for responding.  :)

I do understand the functionality of paragraph tags. The problem is, SMF already inserts linebreaks, so enabling <p> leads to four linebreaks instead of two. I did try enabling it while setting margin: 0  for paragraphs in my CSS file, but that didn't work.

live627


Heatherlly

I tried that and it didn't work, but I was able to do it through PHP.  Issue resolved. :)

Advertisement: