A nerd needs to easily display code fragments in his or her posts, and I've found that problematic in CSBlogs. In dotText I simply highlighted the text in FTB and selected Gray from the color dropdown. Done. This doesn't work in CSBlogs, as the post content first goes through the CommunityServer.Components HTMLScrubber. I love that name. "HTMLScrubber!" Like Underdog!!!...or something.
The HTMLScrubber (as its fun name implies) looks through the HTML for acceptable and non-acceptable tags and attributes, based both on hard-coded values in a local (cached) NameValueCollection and in the MarkUp area of the communityserver.config file. There is a bug in the soup when processing the attributes in the ValidateAttributes() method, because although FTB passes the correctedly encoded HTML, by the time it passes through the Formatter StripAllTags() process and becomes a post.body string, those quotes are removed.
The ValidateAttributes() then wants to walk through an attribute string to validate its attributes. It does so by first splitting the string by double-quotes. D'oh! No double quotes. So an input string of FONT face=arial color=#000000 becomes FONT. Attributes are voted off the island.
So I added some code to put the double-quotes back in before the string is split.
// DBVT fix. Looking for DOUBLEQUOTE
if (tagName == "FONT") // updated. Other tags like IMG and A were crapping out
{
tagAttributes = tagAttributes.Replace("=","=\"");
tagAttributes = tagAttributes.Replace(" ","\" ");
tagAttributes = tagAttributes + "\"";
}
string[] sa = tagAttributes.Split('"');
There is another way to display code as well if you don't want to update the source. CODE is an acceptable tag, so you can enclose your code in, um, CODE HTML tags and add it as a page element to your .CSS. That's what I did here, actually. I added the source fix after I started writing this post, knowing that there had to be an easy fix I could make to continue to use my FTB color dropdown method of displaying code.