|
|
|
|
|
|
|
#include <ranges>
|
|
|
|
#include <stack>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <filesystem>
|
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <chrono>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <date.h>
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#ifndef MARKDOWN_H
|
|
|
|
#define MARKDOWN_H
|
|
|
|
|
|
|
|
namespace mmd {
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "MultiMarkdown/src/libMultiMarkdown.h"
|
|
|
|
#include "MultiMarkdown/src/token.h"
|
|
|
|
#include "MultiMarkdown/src/d_string.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
class markdown_parser{
|
|
|
|
unsigned long extensions = EXT_SMART | EXT_NOTES;
|
|
|
|
unsigned long language = ENGLISH;
|
|
|
|
mmd_engine *engine = nullptr;
|
|
|
|
|
|
|
|
std::unordered_map<std::string, std::string> get_all_metavalues(mmd_engine *engine);
|
|
|
|
|
|
|
|
public:
|
|
|
|
markdown_parser();
|
|
|
|
|
|
|
|
markdown_parser(std::string text);
|
|
|
|
|
|
|
|
markdown_parser(std::string text, unsigned long extensions);
|
|
|
|
|
|
|
|
markdown_parser(unsigned long extensions);
|
|
|
|
|
|
|
|
~markdown_parser();
|
|
|
|
|
|
|
|
std::string parse_to_html();
|
|
|
|
|
|
|
|
std::string parse_to_html(std::string const &s) ;
|
|
|
|
|
|
|
|
std::optional<std::string> get_property(std::string const &file, std::string const &key) ;
|
|
|
|
|
|
|
|
std::unordered_map<std::string, std::string> get_all_metavalues() ;
|
|
|
|
|
|
|
|
|
|
|
|
std::unordered_map<std::string, std::string> get_all_metavalues(std::string const &file_text);
|
|
|
|
|
|
|
|
std::string cut_frontmatter(std::string const &text);
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|