Skip to content

[Bug][Markdown]: codeblock isn't escape the html tag #89

Description

@xzapps

Operating System

Windows

Compiler

MSVC

Compiler flags

NO

maddy version

1.5.0 (latest)

Minimal Mardown example

the inlinecode and codeblock should escape the html tag

What is not working? What did you try?

i try to fix this bug
int the codeblockparser.h
line = Common::escapeHtml(line) + "\n";

and th escapeHtml function

`#ifndef COMMON_H
#define COMMON_H

namespace maddy {

class Common
{
public:

static std::string escapeHtml(const std::string& input)
{
    std::string result;
    for (char c : input) {
        switch (c) {
        case '&':
            result += "&";
            break;
        case '<':
            result += "&lt;";
            break;
        case '>':
            result += "&gt;";
            break;
        case '"':
            result += "&quot;";
            break;
        case '\'':
            result += "&apos;";
            break;
        default:
            result += c;
        }
    }
    return result;
}

};
}

#endif // COMMON_H
`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions