Asked by:
Code block Fonts need to be monospaced / Fix Width

Question
-
This is my yearly request for fixed with fonts in code blocks. Why is this still an issue?
The below example is one I just used and *sigh* the
- #'s in the pattern don't line up
- The C# extension methods don't line up via the period(.).
- The final output doesn't line up by the :
but they do in Visual studio.
string data = @"Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword"; string pattern = @" (?<Key>[^=]+) # Put the first text into the Key capture group (?:\=\s*) # Match but don't capture the = and any space (?<Value>[^;]+) # Get all text til the end of string which is not a ; (?:;?) # Match but don't capture a ; if it exists"; // IgnorePatternWhitespace only applies to the pattern so we can comment it; not regex parsing! Regex.Matches( data, pattern, RegexOptions.IgnorePatternWhitespace ) .OfType<Match>() .ToDictionary( mt => mt.Groups["Key"].Value, mt => mt.Groups["Value"].Value ) .ToList() // To do the foreach below .ForEach( kvp => Console.WriteLine( "{0,-20} : {1}", kvp.Key, kvp.Value ) ); /* Output Data Source : myServerAddress Initial Catalog : myDataBase Integrated Security : SSPI User ID : myDomain\myUsername Password : myPassword */
William Wegerson (www.OmegaCoder.Com)Wednesday, December 21, 2011 6:55 PM
All replies
-
Hi
Thanks for your post.
i am not sure the below information can give you a great help.
Here is one of the MSDN Forums:
located at:you can refer to this category of the forums to find the better forum to post your question.Sunday, December 25, 2011 2:09 PM -
Why is this still an issue?
Have you tried the new forum editor in the CTP MSDN Sandbox? Apparently there have been some changes made concerning this feature.---
Monday, December 26, 2011 5:58 AM -
Here is one of the MSDN Forums:
Qixin, I am a moderator of the Visual C# forum.... This post is meant for the people who run the forums to fix the CSS stylesheet for a pre tag to use a fixed width font.Thanks for your attempt though..
William Wegerson (www.OmegaCoder.Com)Tuesday, December 27, 2011 4:34 PM -
Have you tried the new forum editor in the CTP MSDN Sandbox? Apparently there have been some changes made concerning this feature.
Just tried it here: Fixed Width Font for Code and it is not using a Fixed width font as well. :-(
William Wegerson (www.OmegaCoder.Com)Tuesday, December 27, 2011 4:40 PM -
it is not using a Fixed width font as well. :-(
But look, progress: now we have a nice *permanent* box for displaying code. <eg>---
Tuesday, December 27, 2011 9:29 PM