Skip to content

[Bug][Markdown]: Parser doesn't emit text in HTML blocks (?) #92

@Vardan2009

Description

@Vardan2009

Operating System

Windows

Compiler

MSVC (Visual Studio)

Compiler flags

/Zc:__cplusplus (very probably unrelated)

maddy version

1.6.0 (latest)

Minimal Mardown example

<!-- comment -->
Hello

What is not working? What did you try?

std::shared_ptr<maddy::ParserConfig> mdConfig = std::make_shared<maddy::ParserConfig>();
mdConfig->enabledParsers |= maddy::types::ALL;
auto p = std::make_shared<maddy::Parser>(mdConfig);

{
    std::stringstream stream("<!-- comment -->\n# Testing 1\n# Testing 2");
    std::cout << p->Parse(stream) << std::endl;  // Prints nothing

    // It should've printed something similar, since the headings are
    // treated as plaintext (the comment line is considered HTML), but it seems like the parser
    // just ignores it
    //
    // <!-- comment -->
    // # Testing 1
    // # Testing 2
}

{
    std::stringstream stream("# Testing 1\n<!-- comment -->\n# Testing 2");
    std::cout << p->Parse(stream) << std::endl;  // Only prints <h1>Testing 1</h1>

    // Same issue here
}

{
    std::stringstream stream("<!-- comment -->\n\n# Testing 1\n# Testing 2");
    std::cout
        << p->Parse(stream)
        << std::endl;  // Works properly: <!-- comment --><h1>Testing 1</h1><h1>Testing 2</h1>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions