From 16208f6f3b499103a19b1c3ae61d1cfd71ca102b Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 28 Oct 2025 01:29:52 -0700 Subject: chore: refactor move headers to include folder --- include/markdown_translator.hpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/markdown_translator.hpp (limited to 'include') diff --git a/include/markdown_translator.hpp b/include/markdown_translator.hpp new file mode 100644 index 0000000..6c0c1bc --- /dev/null +++ b/include/markdown_translator.hpp @@ -0,0 +1,39 @@ +#ifndef MARKDOWN_TRANSLATOR_H +#define MARKDOWN_TRANSLATOR_H + +#include +#include +#include +#include + +class MarkdownTranslator { +public: + // Constructor + MarkdownTranslator(); + // Destructor + ~MarkdownTranslator(); + // Main translation function - takes markdown content and returns HTML + std::string translate(const std::string& markdownContent, const std::string& cssPath = "styles/carbon.css"); + std::string processLine(const std::string& line); + +private: + // Helper functions for different markdown elements + void processMetadata(const std::vector& lines); + std::string processHeaders(const std::string& line); + std::string processBold(const std::string& text); + std::string processItalic(const std::string& text); + std::string processLinks(const std::string& text); + std::string processParagraph(const std::string& text); + std::string processSingleFigure(const std::string& text); + std::string processFigureBlock(const std::vector& lines); + // Navigation and table of contents + void generateSideBar(std::stringstream& output, const std::vector& headers); + std::string createAnchorId(const std::string& text); + // Utility functions + std::string getCurrentDateTime(); + + // Member variables + std::string title; +}; + +#endif // MARKDOWN_TRANSLATOR_H -- cgit v1.2.3