From 6e232a67dc1caa633865c16b7c02b81338e1246e Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 29 Oct 2025 18:06:13 -0700 Subject: add code block processing --- include/markdown_translator.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/markdown_translator.hpp b/include/markdown_translator.hpp index f62f7a0..4a62cbc 100644 --- a/include/markdown_translator.hpp +++ b/include/markdown_translator.hpp @@ -19,7 +19,7 @@ public: externalMenuLinks.push_back(menuItem); } enum Theme { - carbon + CARBON }; struct ExternalMenuItem{ @@ -46,6 +46,7 @@ private: std::string processParagraph(const std::string& text); std::string processSingleFigure(const std::string& text); std::string processFigureBlock(const std::vector& lines); + std::string processCodeBlock(const std::string& language, const std::vector& lines); // Navigation and table of contents void prescanHeaders(std::stringstream& markdownStream); void generateSideBar(std::stringstream& output); @@ -71,6 +72,7 @@ private: )" + title + R"( + )"; @@ -82,6 +84,8 @@ private: + + )"; @@ -89,7 +93,7 @@ private: void setTheme(const Theme& theme){ switch(theme){ - case Theme::carbon: + case Theme::CARBON: cssPath = "styles/carbon.css"; break; default: @@ -102,6 +106,12 @@ private: std::string cssPath{"styles/carbon.css"}; std::vector headers; // h1-6 + enum ParseState { + REGULAR, + IN_FIGURE, + IN_CODEBLOCK, + }; + }; #endif // MARKDOWN_TRANSLATOR_H -- cgit v1.2.3