mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-07 13:57:13 +00:00
Any way top stop the parser from adding strange <p> tags? #528
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 @zerogr4vity on GitHub (Apr 18, 2022).
I am using
Markdig.Markdown.ToHtml()to display the contents of a .md file on a webpage. If I provide the following sample string, I get the expected output:Markdig.Markdown.ToHtml("# Text A\nText B\n\n## Text C")becomes
However, if I put the following in a markdown file, I get a weird output:
sample.md:
becomes
I get the expected output when I view the file with Markdown Editor VS2022 extension. I also verified that the file contains the proper characters right before calling the method. Any idea what I can do to achieve the correct output?
@xoofx commented on GitHub (Apr 20, 2022):
Do you have the code that you use to load/parse it? Do you have the exact content on the disk? What is used CRLF or LF, a combination of?
@xoofx commented on GitHub (Apr 20, 2022):
Added a test in commit
17b5500but can't reproduce your issue. Missing a context...@zerogr4vity commented on GitHub (Apr 20, 2022):
The file contains only CRLF endings.
ContractAgreements/Details.cshtml:
sample.md
@xoofx commented on GitHub (Apr 20, 2022):
Your file has a UTF8 BOM marker "EF BB BF", so it generates garbage at the beginning and it does not get removed by
Encoding.Default.GetString, if you e.g aStreamReaderfrom a byte with the detect byte order marks it would work. Not sure why you are using a byte[], but you might want to revisit this.Closing as it doesn't look like an issue in markdig, but an encoding issue on your side.