From 29a0ab1f2b04a9b9a45282b6c9026136b1ed1f6d Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Tue, 28 Oct 2025 01:59:24 -0700 Subject: set CSS theme as a member variable --- include/markdown_translator.hpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'include/markdown_translator.hpp') diff --git a/include/markdown_translator.hpp b/include/markdown_translator.hpp index 6eb32f8..8bf6c84 100644 --- a/include/markdown_translator.hpp +++ b/include/markdown_translator.hpp @@ -13,9 +13,13 @@ public: // 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 translate(const std::string& markdownContent); std::string processLine(const std::string& line); + enum Theme { + carbon + }; + private: // Regex for various tags const std::string headerRegexStr{"^(#{1,6})\\s+(.*)$"}; @@ -48,7 +52,7 @@ private: } // HTML builders - std::string buildHTMLHeader(const std::string& title, const std::string& cssPath){ + std::string buildHTMLHeader(const std::string& title){ return R"( @@ -72,8 +76,18 @@ private: )"; } + void setTheme(const Theme& theme){ + switch(theme){ + case Theme::carbon: + cssPath = "styles/carbon.css"; + default: + cssPath = "styles/carbon.css"; + } + } + // Member variables std::string title; + std::string cssPath{"styles/carbon.css"}; }; #endif // MARKDOWN_TRANSLATOR_H -- cgit v1.2.3