none
forums: code display doesn't use monospaced font

    Question

  • Why doesn't the code insert tool in the forums use a monospaced font like 'courier new'? It seems to be a bug, although it's monospaced in the preview. As long as you can fit 80 characters, that should be fine.

    this is not a monospaced font

    this is a monospaced font



    Saturday, November 18, 2017 10:33 PM

All replies

  • Hi,

    I suppose it would be a specification of [Code Block] in this forum and it would not be intended to fit 80 characters per line. The below includes 120 characters per line. I guess they want to show more characters in [Code Block] by using proportional font.

    .........1.........2.........3.........4.........5.........6.........7.........8.........9.........10........11.......12
    123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

    Regards,


    Ashidacchi

    Sunday, November 19, 2017 2:14 AM
  • 12345678901234567890123456789012345678901234567890123456789012345678901234567890


    12345678901234567890123456789012345678901234567890123456789012345678901234567890


    Actually in this case courier new is smaller.  I can also see it before I save.  I think it's a bug.


    • Edited by JS2010 Sunday, November 19, 2017 4:09 PM
    Sunday, November 19, 2017 2:08 PM
  • I complained about the use of proportional fonts in code blocks when the forums were introduced (or replaced the old newsgroups), perhaps in 2011. I eventually coded scripts that converted code into HTML that specified Courier New, which could be pasted into the forum HTML editor. I used these scripts for years. But in recent years I have just used the Insert Code Block feature with the proportional fonts. For one thing, the colorization standard seemed to change.

    If you are interested in my scripts to convert code into HTML, they are explained and linked on this page:

    http://www.rlmueller.net/ConvertCodeToHTML.htm

    Edit:

    Also, you can suggest forum improvements and new features in this Wiki:

    https://social.technet.microsoft.com/wiki/contents/articles/4703.feature-requests-for-technet-and-msdn-profiles-and-social-platform-tools.aspx


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Monday, November 20, 2017 1:40 AM
  • Thanks.  Lately I've just been adding a style attribute in an arbitrary tag in the html like for span or pre (actually, I like the cmd.exe font, consolas):

    <span style="font-family:'courier new'">courier new</span>

    <pre class="prettyprint" style="font-family:'courier new'">courier new</pre>



    • Edited by JS2010 Monday, November 20, 2017 4:21 PM
    Monday, November 20, 2017 2:29 AM
  • Plus while this area of the forum is wide, the powershell forum https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell is ironically only 76 characters wide in 'courier new' characters of a default size. 


    • Edited by JS2010 Monday, November 20, 2017 3:23 PM
    Monday, November 20, 2017 3:21 PM
  • I've also noticed that in email notifications, the code inserts are in monospace font.  So something funny is happening with the webpage display prettyprint() function.


    • Edited by JS2010 Saturday, December 02, 2017 10:15 PM
    Saturday, December 02, 2017 10:15 PM