progsource / maddy

C++ Markdown to HTML header-only parser library
MIT License
194 stars 39 forks source link

Nor parsing table #51

Open lollita opened 11 months ago

lollita commented 11 months ago

What is the issue?

Why this not work and not return table?

#include <iostream>
//#include <memory>
#include <string>
#include "maddy/parser.h"

std::string ConvertMarkdownToHTML(const std::string& markdownInput) {
    // Configurazione opzionale
    std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();

    //config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;
    //config->enabledParsers |= maddy::types::TABLE_PARSER;
    //config->enabledParsers |= maddy::types::HTML_PARSER;

    //config->enabledParsers &= ~maddy::types::ALL;

    std::istringstream markdownStream(markdownInput);

    std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);

    std::string htmlOutput = parser->Parse(markdownStream);
    return htmlOutput;
}

int main(int argc, char** argv)
{
    const std::string markdownInput = "##TEST \nColumn One | Column Two \n---------- | ---------- \nRow Text 1 | Row Text 2 \nRow Text 3 | Row Text 4\n";//argv[1]
    std::string htmlOutput = ConvertMarkdownToHTML(markdownInput);
    std::cout << htmlOutput << "\n";
    return 0;
}
progsource commented 10 months ago

Table Markup in Maddy is a little bit different to the one from GitHub. See also https://github.com/progsource/maddy/blob/master/docs/definitions.md#tables If the headline should not parse, try a space after the #. I intend to add the more GitHub like table in maddy 2.*