Skip to content

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

Closed
@AlexanderInova

Description

@AlexanderInova

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions