Saturday, March 22, 2014

Improving SharePoint Designer's Code View

Typeface preferences are subjective. That said, some fonts are just more readable than others. This is true even in "code view". Code editors should generally use a monospaced font (a font where each character is the same width), as this allows us to see patterns within lines of code more easily. But your font does not have to be awful. Like Courier New. Why subject ourselves to an outdated, serifed, monospaced font like that? We have better options!

This is the default view of code in SharePoint Designer, using Courier New, 9pt:

Image of SharePoint Designer 2013 in Code View using Courier New at 9pt

Ugly. Hard to read. In my humble opinion.

To change the code view font settings, go to the File tab, then choose Options. Click the "Page Editor Options" button. Then select a different monospaced font. In the examples below, I chose Consolas and set it to 8pt. The font size change is a different issue, but I like it because I can see more lines of code on the same screen.

Image of SharePoint Designer 2013 Page Editor Options dialog

Now my code view looks like this:

Image of SharePoint Designer 2013 in Code View using Consolas at 8pt

Cleaner. Easier to read. In my humble opinion.

There are other fonts you can try as well. Just make sure you can easily distinguish the characters, such as "o", "O", "0" and "i", "l", "1". The following image shows five fonts set to 8pt:

Image of a table of monospaced font examples

Notice that Consolas is slightly skinnier, allowing you to see more code in less horizontal space. Also notice how clearly distinguishable the numeral "0" is from the letter "O". The lowercase "g" is a little weird compared to the others, but I can live with that given the other benefits.

Happy coding!

1 comment: