mirror of
https://github.com/szymon-jozef/static-site-generator.git
synced 2026-09-07 20:20:41 +02:00
added markdown metadata parsing
This commit is contained in:
20
src/markdown.hpp
Normal file
20
src/markdown.hpp
Normal 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);
|
||||
Reference in New Issue
Block a user