aboutsummaryrefslogtreecommitdiffstats
path: root/include/markdown_translator.hpp
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-28 01:29:52 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-28 01:29:52 -0700
commit16208f6f3b499103a19b1c3ae61d1cfd71ca102b (patch)
treea9900e72516d817fc63e32f58eda3cee3c7e84b1 /include/markdown_translator.hpp
parentca56a2618dd306855a4ede4dbcc389d4c714cccd (diff)
chore: refactor move headers to include folder
Diffstat (limited to 'include/markdown_translator.hpp')
-rw-r--r--include/markdown_translator.hpp39
1 files changed, 39 insertions, 0 deletions
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 <string>
+#include <vector>
+#include <sstream>
+#include <ctime>
+
+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<std::string>& 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<std::string>& lines);
+ // Navigation and table of contents
+ void generateSideBar(std::stringstream& output, const std::vector<std::string>& headers);
+ std::string createAnchorId(const std::string& text);
+ // Utility functions
+ std::string getCurrentDateTime();
+
+ // Member variables
+ std::string title;
+};
+
+#endif // MARKDOWN_TRANSLATOR_H
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage