Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved multiline handling of xml textblock. #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

svallebro
Copy link

Changed the way whitespaces are removed. To keep multiline values.

@@ -84,8 +84,7 @@ public static string ToMarkDown(this XNode node, string assemblyName = null)


if (node.NodeType == XmlNodeType.Text)
return Regex.Replace(((XText)node).Value.Replace('\n', ' '), @"\s+", " ");

return Regex.Replace(((XText)node).Value.Replace(@" ", ""), @"^\n|[S*|\n]$","",RegexOptions.Multiline);
Copy link
Owner

@Pxtl Pxtl Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you're fixing this bug... but I'm not getting why you're searching for 13 spaces. Also, shouldn't you use <para> tags if you want linebreaks in your xml comments reflected into the Markdown?

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/para

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had not read about the tag seems like a nice thing to use.

The reason why I used replaced 12 with empty string was that it was the simplest resolution I could come up with to remove the first whitespaces that XML generator added just for structure.

I did not spend much time on this. I just wanted to share the change I needed to make it look more readable in multiline summary comments that I created in the class diagram tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants