Code samples in Microsoft Word tend to get inflamed with the “red squiggle” disease. To keep your sanity while editing code samples, and to present them a bit more nicely to your users, create a style and apply it to all code samples.
- Choose a monospace font.
- In the style editor Format dropdown, choose Language, and then check the box labeled “Do not check spelling or grammar.”
- Ensure no specific color is selected so that colors pasted from your code editor appear correctly (if they look good on a white background).
If you use a Character style (as opposed to a Paragraph style), you can even apply the style to text inline within a paragraph. This can be a good way to set apart “input” text from explanatory text.