Doraku / DefaultDocumentation

Create a simple markdown documentation from the Visual Studio xml one.
MIT No Attribution
157 stars 26 forks source link

Unhandled Exception if additional leading whitespace between <summary> tags #12

Closed Tamnavulin closed 4 years ago

Tamnavulin commented 4 years ago

When it happens: If you comment a variable like this: /// <summary> /// _<-- this is an additional whitespace before the comment text starts /// <summary>

What happens: In this case there will be an exception in DocumentationWriter.cs Line 204

FIX: check length (value) of variable"startIndex" in code

Example: summary = string.Join(Environment.NewLine, lines.Skip(firstLine).Select(l => l.StartsWith(" ") ? l.Substring(startIndex > l.Length ? l.Length : startIndex) : l));

Doraku commented 4 years ago

b9cb8d252581071b91ea34fc850075ff84cb7683 thanks, good catch! Problem of leading whitespace in the first comment line is that it may remove characters of following lines as it change the start index

/// <summary>
///    first line is starting later
///  12345 second line
/// </summary>

would end up as

first line is starting later 345 second line

in the generated documentation, but I think I can live with that for now.