2020-11-16 10:31:58 -08:00
|
|
|
#ifndef MD_PARSER_H
|
|
|
|
#define MD_PARSER_H
|
2020-11-12 16:54:34 -08:00
|
|
|
|
2020-11-13 20:22:56 -08:00
|
|
|
#include <string>
|
2020-11-12 16:54:34 -08:00
|
|
|
#include <cmark-gfm.h>
|
2020-11-14 17:39:05 -08:00
|
|
|
#include <render.h>
|
2020-12-04 16:29:39 -08:00
|
|
|
#include <sstream>
|
2020-11-17 19:33:25 -08:00
|
|
|
/**
|
2020-11-21 15:05:51 -08:00
|
|
|
* \class Parser Markdown parser class, parse the content to an AST model
|
2020-11-17 19:33:25 -08:00
|
|
|
*/
|
2020-11-16 10:31:58 -08:00
|
|
|
class Parser
|
2020-11-12 16:54:34 -08:00
|
|
|
{
|
|
|
|
public:
|
2020-12-14 10:40:08 -08:00
|
|
|
// Singleton
|
|
|
|
static Parser& getInstance();
|
|
|
|
|
|
|
|
static cmark_node * parseContent(const std::string &content);
|
|
|
|
static std::string const renderHTML(cmark_node *node);
|
2020-11-15 16:10:54 -08:00
|
|
|
|
2020-11-12 16:54:34 -08:00
|
|
|
private:
|
2020-12-14 10:40:08 -08:00
|
|
|
Parser();
|
|
|
|
~Parser();
|
|
|
|
Parser(const Parser&)= delete;
|
|
|
|
Parser& operator=(const Parser&)= delete;
|
|
|
|
|
|
|
|
static void addMarkdownExtension(cmark_parser *parser, const char *extName);
|
2020-11-12 16:54:34 -08:00
|
|
|
};
|
2020-11-16 10:31:58 -08:00
|
|
|
#endif
|