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

Newlines are not handled appropriately #96

Open
astrohart opened this issue Jun 7, 2022 · 3 comments
Open

Newlines are not handled appropriately #96

astrohart opened this issue Jun 7, 2022 · 3 comments

Comments

@astrohart
Copy link

astrohart commented Jun 7, 2022

I have a project I am building, DummyFormsApp. It has Vsxmd 1.4.5 installed.

I have XML comment text in the DummyFormsApp.xml file such as:

<member name="M:DummyFormsApp.MainWindow.OnFileExit(System.Object,System.EventArgs)">
	<summary>
	Handles the <see cref="E:System.Windows.Forms.ToolStripItem.Click" /> event
	raised by the <b>Exit</b> item on the <b>File</b> menu.
	</summary>
	<param name="sender">
	Reference to an instance of the object that raised the
	event.
	</param>
	<param name="e">
	A <see cref="T:System.EventArgs" /> that contains the event
	data.
	</param>
	<remarks>
	This method responds by calling the
	<see cref="M:System.Windows.Forms.Form.Close" /> method to close this window,
	which by extension also exits the application.
	</remarks>
</member>

It is this way because I also utilize JetBrains ReSharper and I have it programmed to make all lines XX chars long and no longer (code style). So it hard wraps longer lines, including XML doc comments. I prefer it this way.

However, it produces DummyFormsApp.md content as shown:

image

This has line breaks etc. in it. You need to replace all Environment.NewLine occurrences in the incoming XML documentation file with (blank spaces) during processing.

The current code is preserving line breaks and this is making the .md not be formatted correctly.

@lijunle
Copy link
Owner

lijunle commented Jun 8, 2022

Hi, @astrohart How does your document file (the .xml file) look like?

@astrohart
Copy link
Author

Let me upload a sample, here you go:
MFR.Engines.xml.txt

(I had to rename it with a .xml.txt extension otherwise GitHub won't allow the file to be uploaded)

One of the entries looks like this

        <member name="P:MFR.Engines.ConsoleOperationEngine.Type">
            <summary>
            Gets a <see cref="T:MFR.Engines.Constants.OperationEngineType" /> enumeration
            value that describes what type of operation engine this is.
            </summary>
            <remarks>
            Child classes must implement this property.
            </remarks>
        </member>

Notice the line break after enumeration this is by design for my side, because my code formatter style rules are set accordingly and I can't change them. When I "show all symbols" on the file in Notepad++, it is evident that there is a \r\n after the word enumeration.

I recommend you do something such as value.Replace("\r\n", " ") after you have read the body of a XML tag (assuming value is the variable that your code read it into), and replace it with a single whitespace character, not an empty string.

@astrohart
Copy link
Author

MFR.Engines.md

For reference, I am attaching the corresponding .md file generated by Vsxmd that matches the XML file I submitted above for your comparison.

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

No branches or pull requests

2 participants