[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
  System Requirements
  Improve Performance
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]How To
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
 [Collapse]Visualization Tools
   Member Icons
   Region Painting
   Rich Comments
   Right Margin Line
   Show Color
   Structural Highlighting
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Expand]Refactoring Assistance
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Rich Comments

You can use Rich Comments to apply text formatting to comments in the Visual Studio code editor.

This document contains the following sections:

Expanded Rich Comments Formatting

CodeRush supports the following Markdown-like formatting syntaxes:

  • **Bold**
  • *Italic*
  • _--Underline--_ (underscores on either side)
  • ~Strike-through~

For example, you can format the Copyright Header's text and add your company's logo.

For CodeRush to render a comment similar to the one displayed above, enable the Rich Comments feature.

The following formatting can be applied to selected text inside a comment in CodeRush.

  • **Bold** if you press Ctrl+B
  • *Italic* if you press Ctrl+I
  • _Underline_ if you press Ctrl+U
  • ~Strike-through~ if you press Ctrl+S

CodeRush can also apply formatting (bold, italic, etc.) to comments if you choose the appropriate command from the Embed Selection action menu. To invoke the menu, select text inside a comment and press Ctrl + . or Ctrl + ~. In the invoked menu, open the Embed Selection group and choose the embedding from the list.

Expanded Enable Rich Comments

To enable the Rich Comments feature, use the Editor | All Languages | Rich Comments options page;

or click the Toggle Rich Comments toolbar button.

Expanded Disable Markdown Formatting in Comments

You can cancel markdown characters:

  • with the back slash "\":


  • with "//":

You can also disable markdown formatting in the Rich Comments options page. Deselect the "Show markdown formatting (bold, italic, strikethrough, underline, etc.)" option on the Editor | All Languages | Rich Comments options page.

Expanded Highlight Comments in the Color

CodeRush allows you to highlight important comments, question comments, and task-based comments.

  • Mark comments as important by starting the comment with an "!".
  • Mark comments as questions by starting the comment with a "?".

  • Use the following tokens to highlight task-based comments in the color:

    • TODO
    • BUG (FIXME)
    • HACK
    • UNDONE

You can change the highlight colors on the Rich Comments options page.

Expanded Large and Small Comments

CodeRush gives you the ability to use markdown to create large or small comments.

  • Use one, two, or three "+" characters at the start of the comment to create large comments;
  • Use one, two, or three "-" characters at the start of the comment to create small comments.

You can also use the hashtag character ("#") to specify comment size.

CodeRush decreases comment contrast as the font size increases, and increases contrast as comment size decreases. You can change the contrast, or assign a custom color to each of the large and small comment font sizes. Use the "sized comment color" setting on the Rich Comments options page:

To enable this functionality, make sure you check the "Change comment font size and color using ++, --, #, ##, etc" checkbox:

Expanded LaTeX Formulas Support (Beta)

CodeRush provides beta support for LateX formulas in Rich Comments.

You can enter, view, and edit fully-formatted mathematical formulas in source code comments (C#, Visual Basic, JavaScript, TypeScript, HTML, XAML, CSS, and F#).

How to Enable

The LaTeX Formulas Support feature ships disabled by default. You can enable LaTeX formula support on the Rich Comments options page.

LaTeX Formula Templates

CodeRush provides templates to facilitate LaTeX formula creation. See the Templates for LaTeX Formula Creation topic for more information.

LaTeX Color and Size

Use one of the formats below to specify the formula’s foreground color, background color, and size.

  • <formula foreground;background;size;formula_text>

  • <formula foreground;size;formula_text>

  • <formula size;formula_text>

  • <formula formula_text>

The following screencast shows the LaTeX formula with a different background color, foreground color, and size.

LaTeX Error

The following message is displayed when your LaTeX code is broken:

Expanded Embed Images in Source Code

You can embed images, diagrams, formulas, tables, etc., in source code (C#, F#, JavaScript, TypeScript, Visual Basic, XAML, HTML, CSS, and XML).

  • Copy an image from any application or web browser;
  • Paste the image inside a comment in source code. To do so, right-click the "Paste Image" context menu, or press Ctrl+V or Shift+Insert.

You can see the supported image formats in the Imaging Overview MSDN article.

Expanded Interaction With Images

Right-click an image to invoke the context menu:

The following commands are available:

  • Link... - adds an image click action.
  • Scale Image – uses the mouse to scale an image.
  • Pixel Size – scales an image 200%, 400%, 800% or 1600%.
  • Crop image... – uses a mouse to crop an image.
  • Copy;
  • Cut;
  • Delete;
  • Open File Location.

Select an Image

Click on an image to select it.

Resize the Image

Drag one of the image sizing handles.

Crop the Image

  • Right click and select Crop Image...;

  • Drag the crop handles;

  • Click outside the image (anywhere in the code) to apply your cropping.

Copy, Paste or Cut Images plus Code

  • Select the code and images (with the mouse or Shift+navigation keys);

  • Cut or copy, and paste the code and images into any source file in the solution.

Undo/Redo Changes to Images or the Code

Press undo/redo keys (e.g., Ctrl+Z or Ctrl+Y), or invoke these actions through the Visual Studio undo/redo toolbar buttons.

Indent an Embedded Image

Add or remove spaces before the leading comment delimiter.

Hide Leading Comment Delimiters

You can add a backtick (`) character after the leading comment delimiter to hide this delimiter.

Make sure you check "Hide comment delimiters (`) when a backtick follows the leading comment delimiter" checkbox to enable this functionality.

Add a Link to an Image

Right-click an image and select Link....

In the Action on Image Click menu you can add one of the following image-click actions:

  • Open a URL;
  • Execute a CodeRush command;
  • Execute a Visual Studio command.

For example, the following image shows how to customize the open URL action on an image click.

The customers can click the link that takes them to the devexpress.com community site.

Expanded See Also

Is this topic helpful?​​​​​​​