forums: code display doesn't use monospaced font RRS feed

  • 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.




    Sunday, November 19, 2017 2:14 AM
  • 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:


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

    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 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 2, 2017 10:15 PM
    Saturday, December 2, 2017 10:15 PM