Tuesday
2024-12-24
11:10 PM
CATEGORIES
E-BOOKS [31]
VIDEOS [16]
TECH NEWS [86]
CLICK ON DIS(MUST WATCH)
TEST [1]
PLEASE WATCH THIS
SCIENTIST BIOGRAPHY [4]
PLEASE READ
BUISINESS DETAILS [13]
movies [0]
watch movies ol nd u can download
Curriculum Vitae Overview [7]
Interview Questions [3]
LATEST TECHNICAL IMPORTANT NEWS [27]
Block title
CHAT
BlomMe
Statistics

Total online: 5
Guests: 5
Users: 0
FOLLOWERS
Login form
Calendar
«  August 2011  »
SuMoTuWeThFrSa
 123456
78910111213
14151617181920
21222324252627
28293031
$TOp It
RATE MA BLOG
Rate my BLOG
Total of answers: 71
Search
LOGIN
Block title
dictionary
POST COMMENTS
SHARE
VISITORS
A HEARTY WELCOME TO MA VISITORS 4R ENTERIN MA BLOG THNX 4R VISITIN MA BLOG
STUDENTS QUEST
Main » 2011 » August » 23

How I Think Posting HTML In Comments Should Work

People post a good bit of HTML in the comments of articles on this site. They are trying to demonstrate something, ask for troubleshooting help, show alternate techniques, etc. This is excellent. I want to encourage this as much as possible. Unfortunately people are often confused on how to do it correctly and get frustrated when it comes out wrong.

I have to post instructions in the comment area to teach people the best way for this site:

  • You can use basic HTML
  • When posting code, please turn all < characters into &lt;
  • If the code is multi-line, use <pre><code></code></pre>

Ideally I'd like to get rid of all of those instructions completely, and have everything "just work". Here are two changes that would get pretty close to ideal for comments on this site:

1. Any HTML that isn't one of the "allowed tags" gets escaped.

WordPress has this default set of allowed tags:

<a href="" title="">
<abbr title="">
<acronym title="">
<b>
<blockquote cite="">
<cite>
<code>
<del datetime="">
<em>
<i>
<q cite="">
<strike>
<strong>

If someone uses these tags in a comment, they will apply to that text and render appropriately. If they use any other tag, it should escape, not be stripped or inappropriately render. So:

I'd also say that if it's a single line of code as in this example (does not contain line breaks) it should wrap the newly escaped code in <code></code> tags.

Also, if the code is already escaped like &lt;span&gt; then leave it alone.

... Read more »

Category: LATEST TECHNICAL IMPORTANT NEWS | Views: 2462 | Added by: kc | Date: 2011-08-23 | Comments (14)

/news/0-0-1-0-16-4