|Problems? Is your data what you think it is?|
<pre> vs. <code> tagsby almut (Canon)
|on Apr 25, 2008 at 22:56 UTC||Need Help??|
Yes, I've read Writeup Formatting Tips and Perl Monks Approved HTML tags and I'm well aware that <pre> tags are discouraged here, in general — for a number of good reasons which I do appreciate and normally abide by.
Still, occasionally, I use <pre> tags in place of <code> tags, because the former allow you to embed HTML markup, such as <b> or <i>, which will be honored when the <pre>-formatted section is rendered. IMHO, this does have its uses in a few selected cases, e.g. to highlight specific fragments in some program output, in order to make things easier to read. As far as I know, this is not possible within <code> sections (at least, I wouldn't know how).
With this reasoning in the back of my mind, I did make use of <pre> tags and <b>/bold highlighting in a recent node to have some debug output be rendered something like this:
... Just used Second in Data Methods are exported from First First::import(): @EXPORT_OK = ... After using First in Second ...
And that's what it looked like initially when I had posted the node. After having reloaded it about half an hour later, however, it looked like this
apparently because someone had replaced the <pre> tags with <c> tags (or do we in the meantime have an automatic mechanism which periodically goes through all nodes to replace any evil <pre> tags? — if so, I missed it being announced on What's new.)
Okay, not a big issue. But what particularly surprised me was the relatively short time frame within which this happened. Otherwise, it often takes a whole day or longer until considered nodes are finally being fixed, even if they display as some illegible blob of text and code all mixed up in one paragraph.
So I'm wondering what sin I have committed that made immediate action necessary :) — while the parent node, for example - which has been considered for not using code tags - is still waiting for some benevolent janitor's intervention at the time of this writing...
It can hardly have been the line length, because the longest line in the snippet in question is just 69 characters. Also, I can't imagine why anyone would want to one-click-download some dull debug output, or have the snippet be decorated with the line numbering that <code> tags optionally offer.
So, to recap, is there anything unconditionally wrong with using <pre> tags? If so, why not disable them entirely in the first place?