Pony request, "code" tag. January 19, 2009 1:52 PM   Subscribe

Pony request: Be nice if the "code" tag worked as expected.

The use of the code tag is fairly frustrating in that it doesn't automatically translate left and right angled brackets into harmless HTML entities, and when you preview, having carefully and tediously gone through and manually edited, you find that they're all back again.

Pony: Simply not allow any other HTML within the "code" tag (as it should be) and then automatically convert the tag brackets. Line numbers would be nice, but hey.

If people are using "code" for other uses (namely, I think, to avoid the double line spacing of the "pre" tag, maybe fix the "pre" tag so it works as expected if it's a big problem?
posted by maxwelton to Feature Requests at 1:52 PM (35 comments total)

+1
posted by Blazecock Pileon at 1:56 PM on January 19, 2009


The HTML code tag isn't supposed to automatically translate anything within. At least, I don't expect that behavior. Some bulletin board systems have a [code] tag that might exhibit this behavior, but that's not how the HTML tag works.

There might be a case for having a special code tag like other systems do, but we shouldn't make HTML behave in a strange way here compared with other contexts.
posted by pb (staff) at 2:01 PM on January 19, 2009 [2 favorites]


I use <code> here in a semantic manner, to indicate computer code or computer-generated text. As pb said, it's not supposed to translate < into &lt;. And it's useful to put some additional emphasis, like a bold font-weight, into some code when you're pointing out a particular thing. So I'd definitely dislike that part of it.

Besides, if you're hardcore, you've already got something out there that translates HTML into HTML-embeddable text.
posted by adipocere at 2:18 PM on January 19, 2009


It would also be nice if the coda tag worked, so that when you reached the end of my comment, you could re-read <to coda> the wisdom I've shared and then conclude at its proper ending. </d.c. al coda>
posted by yeti at 2:21 PM on January 19, 2009 [5 favorites]


I am not hardcore, and would like to ask for a special code tag, which isn't the HTML <code> thing, in line with the original pony.
posted by pompomtom at 2:23 PM on January 19, 2009


Is <Pre> still all screwed up?
posted by Artw at 2:23 PM on January 19, 2009


I'm looking at that now Artw. I know it's working fine here in MeTa, but there were some problems moving over to Ask so I need to check.

Either way, the <pre> tag doesn't translate HTML entities inside to &lt; and &gt; either so the same problem exists. Sharing raw HTML in any web system that isn't specifically designed for sharing raw HTML is tricky, and how you do it depends on the specific filtering and quirks of whatever system you're using. If we can make some changes to Ask to make it more intuitive and less quirky to share HTML we should. (Fixing <pre> is a big part of that.) But web development questions are a small fraction of the total number of questions and answers here.
posted by pb (staff) at 2:33 PM on January 19, 2009


I believe Wordpress applies this sort of automatic escaping to <code> blocks in comments (when that tag is enabled). Perhaps at least that's where the idea arose that this is standard behavior.
posted by Wolfdog at 3:19 PM on January 19, 2009


Sites like Stack Overflow and Apple's developer support forums may point to ways to safely handle code or preformatted text. There are other, similar examples.
posted by Blazecock Pileon at 3:46 PM on January 19, 2009


Sorry, PB, I guess I should have labled that "as I expected." Of course, I also have expectations like "wallet = full" which are rarely met, so...

Perhaps the miniature pony would be if someone has edited their text to eliminate the brackets, that they don't get re-translated in the textarea on preview? I know that's how textareas work, but maybe there is some way around it?
posted by maxwelton at 3:53 PM on January 19, 2009


I know that's how textareas work, but maybe there is some way around it?

Yep, that's the way it's supposed to work, but the extended area was not being escaped for the textarea on the question preview page. If you type &lt; in the textarea, you're definitely supposed to get &lt; in the textarea on preview. It just wasn't working, sorry about that.
posted by pb (staff) at 4:14 PM on January 19, 2009


The HTML code tag isn't supposed to automatically translate anything within.

It took me multiple reads and much pondering to realize you were disagreeing with the pony.
posted by DU at 4:26 PM on January 19, 2009


Is anyone willing to tell this noob how to do the small-print thing? What I thought did it, doesn't.
posted by Joe Beese at 4:33 PM on January 19, 2009


DU, ambiguous word collision could hinder comprehension I see now.
posted by pb (staff) at 5:05 PM on January 19, 2009


View source, Joe
posted by popechunk at 5:05 PM on January 19, 2009


But web development questions are a small fraction of the total number of questions and answers here.

This problem has driven many long-time members crazy here for years, and if you solved it, you'd be a huger hero.
posted by popechunk at 5:07 PM on January 19, 2009


The <pre> tag is working better on Ask now—no more double-spacing.
posted by pb (staff) at 5:33 PM on January 19, 2009


I would say my work here is done, but, of course, I didn't do squat except whine.

Thanks for fixing those two things, my pony can officially be led to the glue factory (though I still think it would be nifty to have some sort of pseudo "code" thingy which would automagically escape stuff within the tag).
posted by maxwelton at 7:09 PM on January 19, 2009


Please don't remove the few toys we have left.
posted by Cranberry at 12:16 AM on January 20, 2009


Pony Request: Don't sacrifice the clarity of your lead line in favor of conveying a terse/laconic tone. When I clicked in I was expecting a weirdass wacky MeTa call-out admonishing someone who was rude because something worked properly, and am now horribly disappointed.
posted by Alvy Ampersand at 12:30 AM on January 20, 2009 [1 favorite]


I AM IGNORING THIS PONY. THE CODE TAG WORKED AS EXPECTED AND I AM BEING MEAN.
posted by SpiffyRob at 7:27 AM on January 20, 2009 [1 favorite]


I mourn the passing of the <xmp> tag.
posted by Crabby Appleton at 10:15 AM on January 20, 2009


At one point, I suggested using FCK editor to do the entity-conversion thing - < to &lt; for example - & it might be helpful. Extra spacing might be an issue, but I haven't gone over the wiki page on ASCII Art to update it.
posted by Pronoiac at 11:00 AM on January 20, 2009


Joe - <small> acts as a Debigulator.
posted by Pronoiac at 11:09 AM on January 20, 2009


How do you get the super-tiny text? Like small x 2? Nested smalls don't seem to work...what's the secret?
posted by cowbellemoo at 11:56 AM on January 20, 2009


I've tried the "font size="#"" tags, but they get stripped out. It didn't even let me use Comic Sans.
posted by dunkadunc at 1:08 PM on January 20, 2009


Are you on IE, cowbellemoo? I am, & it doesn't seem to be working here, though I think it did:

Small. Small small. Small small small.

So is that an IE thing, there, like the lack of blink? How does this look on other browsers?
posted by Pronoiac at 1:11 PM on January 20, 2009


So, nested small works on Firefox & Mobile Safari. Blink only worked on Firefox. Updating formatting, known allowed tags on the wiki, which is about tags allowed on Mefi not on the wiki, which leads to some fun with regards to tags that the wiki does not like, so examples of those:

  • abbr example - MeTa example (mouseover)
  • blink example - example


  • Clarification of pre, code, ASCII art forthcoming.
    posted by Pronoiac at 11:12 PM on January 20, 2009


    Pastebin is regularly mentioned in these kinds of threads.
    posted by philomathoholic at 8:56 AM on January 21, 2009


    And the impermanence of pastebin code is also mentioned—the code you post there eventually expires. That means it's bad for future digital archeologists who will surely be studying everything we do here.
    posted by pb (staff) at 9:02 AM on January 21, 2009


    Pastebin offers "forever" as an expiration option.

    *furtively glances around*

    Aaaactually, the source for pastebin is available. You could run that here.
    posted by Pronoiac at 11:47 AM on January 21, 2009


    You could run that here.

    Interesting idea, a code.metafilter.com running Pastebin could definitely help solve this problem.
    posted by pb (staff) at 12:28 PM on January 21, 2009


    Hmm, seems the nested smalls do work! I'm on firefox and I just remember it not working one time. Maybe it's the live preview that doesn't show the supersmalls. Oh well, thanks.
    posted by cowbellemoo at 8:28 PM on January 21, 2009


    Oooh, and pb is dogearing the pony catalog! Thanks, pb! I was always irked when the preview destroys my python and then I don't post because I'm such a noob that I can't get the indentation right in a webpage for pete'ssake and it's squelching answers and no one wants that!
    posted by cowbellemoo at 8:33 PM on January 21, 2009


    For the record, <pre> and <blockquote> are working better at MeFi now too. Update your ASCII art formatting scripts accordingly.
    posted by pb (staff) at 3:22 PM on January 22, 2009


    « Older NY Comicon?   |   Who makes up the mefi audience? Newer »

    You are not logged in, either login or create an account to post comments