80

Does anyone know how to insert a line break into a summary comment in order for the line break to be reflected in Intellisense documentation?

To clarify, assume code documentation..

/// <summary>
/// Some text documentation
///  - a line break - 
/// Some more documentation
/// </summary>
public void SomeMethod() { }

So when using this method Intellisense offers a summary for the method formatted like this:

Some text documentation

Some more documentation

(Note - the 'para' tag doesn't create empty line breaks - I've tried it!)

2
  • A "para" is half answer (it's actually double break), beginning and end of line gets truncated. To enforce break a line at the beginning and the end of summary add following "<para>&#129;</para>" (&#129; character get omitted - actually non visible and zero space). Commented Mar 17, 2018 at 9:14
  • 2
    As of Visual Studio 2019, you can add line breaks using <br/> in xml documentation. Refer the answer here. Commented Sep 18, 2019 at 14:32

5 Answers 5

77

Try using this.

/// <summary>
/// <para>Paragraph 1.</para>
/// <para>Paragraph 2.</para>
/// </summary>

But I don't think you can have an actual empty line. Empty para tag gets ignored.

Sign up to request clarification or add additional context in comments.

6 Comments

I thought you just wanted a line break. I don't think you can have an actual empty line.
how does MS do it with exceptions in methods for example?
Exceptions are separate tags in the XML. It's not a blank line in the summary, it's just rendering different sections of the documentation
A slightly nicer version: /// <summary> /// <para>Paragraph 1.</para> /// <para>Paragraph 2.</para> /// </summary>
Basically replace "<para>XYZ</para>" by "XYZ<para/>"
|
47

Try this:

/// <summary>
/// <para> [Non-Breaking Space] </para>
/// </summary>

[Non-Breaking Space] is obtained using Alt+255 (using the Numpad).

It will show up as an empty new line. I know this is old, but it worked for me today.

9 Comments

+1: I finally have a place to write //Magic, do not touch.
Just something I want to say: WOW!
That maybe the most awesome and yet horrible thing to happen simultaneously at so many of the same levels that I have ever seen. For adding empty lines, I'll use Al Erickson's suggestion of &#160; but for doing indenting, this is way nicer.
Alt + 0173 looks more like magic. It's the invisible character and works, too.
how to use Alt+255 in VS 2015? when i try Alt+255 in VS 2015 nothing happens
|
28
/// <summary><br />
/// <para>To treat comment line like a DIV tag, surround them with PARA tags.</para><br />
/// <para>To add a break with whitespace, add the following line:</para><br />
/// <para>&#160;</para><br />
/// </summary>

7 Comments

<br /> alone worked for me. Using the <para> tags created too much padding which pushed the rest of my comments beyond the overflow.
<para>&#160;</para> was the thing I was looking for, tnx :)
<br /> doesn't work in VS 2017.
<br/> DOES work in VS 2019.
should be accepted answer still works in vs 2022 despite its pretty old html tag
|
7

Your only hope is probably something cludgy like this:

/// <summary>
/// <para>line one</para>
/// <para>_</para>
/// <para>line two</para>
/// </summary>

1 Comment

cludgy yes, but thats as close as ive got so far
-3

Well, it is Xml. Maybe &#10;&#13;

1 Comment

nope that doesn't do it either ...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.