Is em or var preferable? (em seems less technically correct, but it’s present in the editor GUI, which is very helpful.) Also, what items should get italicized?
I did some searching in the MDN guidelines, but didn’t find any info about this.
We do not use <var>. We probably should be, but we never have. Any places that do use it actually break rendering, because we do not have styling in place for <var>.
Styling should be applied to anything that the programmer names themselves:
( all the examples here should of course be in <code>, but the forum doesn’t allow it)
Variable storing a return value [retValueName = somefunction()]
Input parameter name [somefunction(parameter1, parameter2)]
I think we should update the Kuma base stylesheet to style the <var> element with the same style as the <em> element when contained within a <pre> block, otherwise style it like <code>.
Is there perhaps a way to make the MDN editor, or MDN’s CSS styles, deal with <var> and <em> more gracefully?
Given the nature of a wiki, it’s difficult to get everyone on the same page with using one vs. the other. For example, I edited this page, replacing all the <var>s with <em>s, but then a few days later someone else went and did the opposite. Or maybe I just need to lighten up on my perfectionism?
Never! . Seriously though: as long as MDN is a Wiki it’s going to be impossible to make anything consistent, so it’s probably not worth worrying about. I hope that one day it won’t be a Wiki any more, and we’ll spare people from hand-formatting stuff like this.
So, unfortunately, it’s a little tricky to do anything about it. Given that we never use <var> for anything, we could consider blocking that from being used in our HTML bleaching filter.
At a minimum, yes, we could at least make it look the way we want it to. But I’m not sure I wouldn’t prefer we just block it outright.
@exe-boss: I’m curious why you feel that <var> is the way to go. They’re not variables, really. They’re placeholders… I guess that’s similar, but it’s not really the same.
Sure, but these aren’t variables. I get that <em> isn’t really correct because emphasis isn’t what we’re looking for, but I don’t think <var> is right either.
I personally wish we had a few classes to use, like:
And so forth. That would be more… appropriate… to my mind. Not to mention giving us incredible powers when it comes to using CSS selectors to locate keywords of interest.