added markdown metadata parsing

This commit is contained in:
2026-01-03 21:21:09 +01:00
parent 1460db6587
commit 9f9685170c
2 changed files with 63 additions and 0 deletions

20
src/markdown.hpp Normal file
View File

@@ -0,0 +1,20 @@
#include <optional>
#include <set>
#include <string>
struct Metadata {
std::string author;
std::string date;
std::string title;
std::set<std::string> tags;
};
// Reads the metadata of the markdown file
// Metadata are in yaml format at the top of the file
// They are separated from the rest of the file with `---` at the beginning and
// at the end.
std::optional<Metadata> get_metadata(const std::string &FILE_PATH);
// Reads the markdown file and converts it to html.
// Return everything in one string
std::string get_html(const std::string &FILE_PATH);