Is There A Way To Configure ToHtml For Not Adding '\n' At The End of Every Converted String? #533

Closed
opened 2026-01-29 14:38:55 +00:00 by claunia · 1 comment
Owner

Originally created by @napierbw51 on GitHub (May 5, 2022).

Currently using the Markdig.Markdown.ToHtml adds a '\n' character at the end of every string that is converted. This can be shown using the C# Online Compiler:
image

Is there a way to configure ToHtml so that the new line character isn't added? Currently, in my project I'm using .TrimEnd('\n') to remove it but I'm looking for a more graceful solution.

Originally created by @napierbw51 on GitHub (May 5, 2022). Currently using the Markdig.Markdown.ToHtml adds a '\n' character at the end of every string that is converted. This can be shown using the C# Online Compiler: ![image](https://user-images.githubusercontent.com/23728353/166942651-ee26f86b-e0e9-4f7e-917c-c5438a2d23b1.png) Is there a way to configure ToHtml so that the new line character isn't added? Currently, in my project I'm using .TrimEnd('\n') to remove it but I'm looking for a more graceful solution.
claunia added the question label 2026-01-29 14:38:55 +00:00
Author
Owner

@xoofx commented on GitHub (May 6, 2022):

Is there a way to configure ToHtml so that the new line character isn't added?

No. The code changes to support this would be significantly more involving than the .TrimEnd('\n') on the final string.

@xoofx commented on GitHub (May 6, 2022): > Is there a way to configure ToHtml so that the new line character isn't added? No. The code changes to support this would be significantly more involving than the `.TrimEnd('\n')` on the final string.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#533