stuff-from-scratch/apps/website-generator/MarkdownContentParser.h

22 lines
543 B
C++

#pragma once
#include <string>
#include <optional>
#include <unordered_map>
#include <filesystem>
#include <vector>
using Path = std::filesystem::path;
class MarkdownDocument;
class MarkdownContentParser
{
public:
using FileMetadataItem = std::pair<std::string, std::string>;
using FileMetadata = std::unordered_map<std::string, std::string>;
std::pair<FileMetadata, std::unique_ptr<MarkdownDocument>> run(const Path& path);
private:
std::optional<FileMetadataItem> checkForMetadataItem(const std::string& line) const;
};