mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
How to generate real HTML? #210
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @topfunet on GitHub (May 31, 2018).
this is my code:
var pipeline = new MarkdownPipelineBuilder().ConfigureNewLine(Environment.NewLine).UseAdvancedExtensions().Build();
var result = Markdown.ToHtml("This is a text \r\n\r\n with some emphasis", pipeline);
this is the OUTPUT:
"
This is a text
\r\nwith some emphasis
\r\n"BUT what i want is:
This is a text
with some emphasis
Because \r\n is for WPF not for real HTML, i want to put result to a html page, so how can i do it?@Kryptos-FR commented on GitHub (May 31, 2018):
Are you sure you are using the library correctly? I just tried and I get the expected:
@xoofx commented on GitHub (May 31, 2018):
@topfunet first, you should learn how to format your github issue using markdown (use escape code, code blocks...etc.). It is almost unreadable as-is as I had to go back to edit your issue to see exactly the expected markdown. That's also a bit ironic to use a markdown library but not use markdown properly here 😐
Secondly, this is confusing and wrong. You are using
Markdown.ToHtmlso there is absolutely zero WPF involved here. Also, what do you mean by real HTML?\r\nare known as#textwhite spaces in HTML and they are perfectly valid output inside tags and between tags. You should not even care about them, as for most of the case, they are not displayed by browsers.Markdig provides a method to output a HTML fragment (so no
<html>, <head>, <body>tags), something that you can put into a HTML page/body...etc. It is up to your application to integrate markdig and insert the result of the conversion at the proper place.Closing as there are no issues here related to the library correctness.
@vexx32 commented on GitHub (Feb 26, 2021):
@xoofx
I've been looking for this but several google searches and searches in this repo have come up completely empty. How can this be done?
EDIT: Apparently I just hadn't realized that was the default behaviour for Markdown.ToHtml(). Never mind then, thanks! 😁