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-11-12 16:54:34 -08:00
|
|
|
|
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-11-16 10:31:58 -08:00
|
|
|
Parser();
|
2020-11-15 16:10:54 -08:00
|
|
|
cmark_node * parseFile(const std::string &filePath);
|
|
|
|
std::string const renderHTML(cmark_node *node);
|
|
|
|
|
2020-11-12 16:54:34 -08:00
|
|
|
private:
|
2020-11-15 16:10:54 -08:00
|
|
|
int options;
|
2020-11-12 20:27:47 -08:00
|
|
|
|
2020-11-12 19:52:19 -08:00
|
|
|
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
|