Posting code in a scripts comments

in Userscripts.org discussion
Subscribe to Posting code in a scripts comments 9 posts, 6 voices



mungushume Scriptwright

When posting a comment on a script you are told Presentational HTML allowed (we help break your paragraphs and link your links).
I've just been trying to add a comment that contained some code. Unfortunately the code i was adding contained what amounted to a link. On posting the comment the link was evaluated.
Is there anyway of specifying that the following text is not to be evaluated?
Maybe tags or something?
Also maybe we can have a list of the tags we can use?
Cheers

 
Henrik N Admin

There have been changes committed to the site to not linkify URLs in code tags. Hopefully it will go live sometime soon.

Listing the tags we can use is a tiny line of code, but it's a bit tricky to figure out how to present that info. Any ideas? This is ticket 79.

 
Joel H Scriptwright

Henrik:

What's wrong with

Presentational HTML allowed
(we help break your paragraphs and link your links)
<code> <pre> <tag> <tag> <tag>

to the right of the text entry box?

-Joel

 
alien_scum Scriptwright

I like the idea so I created this script that lists a bunch of tags that work and allows you to click them to insert them. I don't think that the list is complete, so any suggestions of extra tags would be appreciated. I would love to see this implemented in the site though.

 
Henrik N Admin

Joel: Well, I think there are perhaps too many tags for that. This is the list (in SVN trunk, so not necessarily what the live site allows):

Whitelisted tags: del dd h3 small big sub tt fieldset a ul h4 cite dfn legend h5 kbd code b ins img acronym h6 sup pre blockquote dt br output p strong param div samp embed li ol var em object h1 address i abbr h2 span hr

Whitelisted attributes: href cite dir class title src height datetime alt width

 
alien_scum Scriptwright

Wow that is a massive list. I've just gone for a selection of the more useful ones and it's still pretty big, hover I like to think that I would use some of the more obscure ones, especially <var>, at some point.
They could all go in a popup box that appears when you click "presentational HTML allowed" then only the most used be shown usually.

 
Joel H Scriptwright

I agree with alien_scum; I'd show the common ones, like i, p, div, code, and b, and say 'click here for complete list'.

-Joel

 
znerp Scriptwright

Out of interest, why is the div attribute whitelisted? Surely it could be used to add extra stuff onto the us.o pages. I've not tried it out personally, but I've noticed that Facebook Auto-Colorizer uses the 'editbox' div to put that black bar at the bottom of the script page. Could this also be used to add extra stuff to other sections of the page in scripts/forums, or am I missing something fundamental?

 
ScroogeMcPump Scriptwright

Okay, there are three places I know of on here where one can post HTML: script descriptions, script comments, and forum messages. Are the rules for what's allowed the same for all three?

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel