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

Inline markup with leading/trailing white-spaces result in invalid markdown #388

Closed
AlexanderInova opened this issue Apr 8, 2024 · 7 comments
Labels

Comments

@AlexanderInova
Copy link

AlexanderInova commented Apr 8, 2024

Description

Inline markup (emphasis and strong emphasis) surrounded by leading or trailing white spaces results in incorrectly flanked markdown, causing it not to render as expected.

See https://spec.commonmark.org/0.31.2/#example-351 for further details.

Steps to reproduce

Use HTML that contains leading or trailing white spaces within inline markup like <em>, <strong>, <b>, <i> or similar.

Here is an example:

var html = """
           This <em>results</em> in <strong>invalid </strong> markdown.
           """;
Console.WriteLine(new ReverseMarkdown.Converter(new ReverseMarkdown.Config()).Convert(html));

This results in:

This *results* in **invalid ** markdown.

Since the second ** is not flanked correctly, it doesn't render as expected (according to input HTML):
This results in **invalid ** markdown.

@AlexanderInova
Copy link
Author

@mysticmind I assume that issue is that the Chomp extension function does not call Trim when all = true.

@mysticmind
Copy link
Owner

@AlexanderInova I am unavailable for few days, will revert to you once I am available.

@AlexanderInova
Copy link
Author

AlexanderInova commented May 3, 2024

@mysticmind In order to try to speed this a little up, I created a PR #390 that might fix the issue. I would really appreciate your support.

To be honest: I didn't really read all the code of this repository, so please review this small change carefully and ensure that this doesn't mess up other functionality of your library.

Thank you very much in advance. :-)

@mysticmind
Copy link
Owner

Hey @AlexanderInova, I was completely unavailable for few weeks now with a few of personal urgency/events. I will surely take a look tonight and do a release accordingly.

Apologies to keep you waiting and thanks for the PR.

@mysticmind
Copy link
Owner

4.4.0 is released to NuGet with a fix for this. Please run a test and keep me posted.

@AlexanderInova
Copy link
Author

AlexanderInova commented May 6, 2024

Hey @mysticmind,

we integrated your update into our project and it seems to work just fine. Our QA just approved the internal rollout.

Thank you very much. You should receive a little donation for your investigation shortly. We appreciate your work. ❤️

@mysticmind
Copy link
Owner

@AlexanderInova Glad to hear this and thank you so much for the sponsor amount, appreciate it 👍

On a side note, I have seen large companies use the lib but never bothered to sponsor even a token amount till date.

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

No branches or pull requests

2 participants