HTML in posts (General)

by Peter, Thursday, September 15, 2011, 00:47 (4628 days ago)

Would it be possible to (easily?) modify the code to allow HTML in posts in certain circumstances. I'm thinking along the lines of allowing certain users to use a tag like [html] so that it is rendered.

I have a forum I'd like to use to discuss HTML, and it would be handy to use the [ code ] tag to show the code, and then be able to actually show what it does.

For example:

<div style="width:100%; background:#2F4F4F url('http://quickforum.tk/gallery/albums/userpics/10001/thumb_23.jpg'); color:#fff;">
<div style="float:right; padding:20px;">Clintwood, Virginia USA</div>
<div style="padding:10px 20px; font-size:2em;"><strong>Clintwood</strong>Connection</div>
</div>
 

[html]
HERE THE ABOVE CODE WOULD BE RENDERED
[/html]

I understand HTML has been traditionally been disallowed in interactive sites due to security concerns, and this gave rise to all these alternative markups (BB Code, wiki, etc.), but to me, that seems like overkill. Why not use an approach like Drupal, and simply filter potentially dangerous HTML? The truth is, the majority of of HTML is perfectly safe from a security standpoint, and some fancy regex and string manipulation can easily filter the small percentage that is not.

Nothing against BB Code, but it does get in the way sometimes of doing something that should be simple. HTML *is* the language of the Web, and not allowing it is somewhat analogous to saying, "This board is about France, but because French contains some bad words, you will need to learn BB Japanese to post here."

負荷を笑う :-D

Instead of all these alternative markups, I'd like to see some well-tested and solid drop-in modules to filter HTML from a whitelist/blacklist approach; e.g.,

Allow ONLY the following HTML:
<a> <strong> <em> <div> <span> <img> <p> <h1> <h2> <h3>

** or **

Allow all HTML EXCEPT:
<object> <script> <input> <form> <blink>

Just some rambling. Any opinions on this? :-P


Complete thread:

 RSS Feed of thread