From 92c059912e37b127b396982b458fa891e4d8f8ff Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 27 Aug 2023 19:18:16 -0400 Subject: [PATCH] add markdown support --- .gitmodules | 3 + CMakeLists.txt | 5 + crow_test/webcontent/menu_bar.part | 8 +- include/crowsite/site/{projects.h => posts.h} | 6 +- include/crowsite/util/md_to_html.h | 18 +++ include/crowsite/util/memory_reader.h | 104 ++++++++++++++++++ include/crowsite/utility.h | 1 + libs/crow/CMakeLists.txt | 7 ++ libs/crow/include/crow/http_connection.h | 2 +- libs/crow/include/crow/http_response.h | 15 ++- libs/crow/src/http_response.cpp | 2 +- libs/crow/tests/catch.hpp | 12 +- libs/md4c | 1 + src/crowsite/site/posts.cpp | 27 +++++ src/crowsite/site/projects.cpp | 17 --- src/crowsite/util/md_to_html.cpp | 76 +++++++++++++ src/crowsite/util/memory_reader.cpp | 70 ++++++++++++ src/crowsite/utility.cpp | 12 ++ src/main.cpp | 12 +- 19 files changed, 360 insertions(+), 38 deletions(-) rename include/crowsite/site/{projects.h => posts.h} (85%) create mode 100644 include/crowsite/util/md_to_html.h create mode 100644 include/crowsite/util/memory_reader.h create mode 160000 libs/md4c create mode 100644 src/crowsite/site/posts.cpp delete mode 100644 src/crowsite/site/projects.cpp create mode 100644 src/crowsite/util/md_to_html.cpp create mode 100644 src/crowsite/util/memory_reader.cpp diff --git a/.gitmodules b/.gitmodules index 6b10e5c..644c41f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "libs/crow"] path = libs/crow url = https://github.com/CrowCpp/Crow +[submodule "libs/md4c"] + path = libs/md4c + url = https://github.com/mity/md4c.git diff --git a/CMakeLists.txt b/CMakeLists.txt index e265c64..e5a629d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,9 @@ else () endif () add_subdirectory(libs/BLT) + +add_subdirectory(libs/md4c) + include_directories(include/) include_directories(${CURL_INCLUDE_DIRS}) include_directories(${SQLite3_INCLUDE_DIRS}) @@ -49,6 +52,8 @@ target_link_libraries(crowsite Crow::Crow) target_link_libraries(crowsite ${CURL_LIBRARIES}) target_link_libraries(crowsite OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(crowsite SQLite::SQLite3) +target_link_libraries(crowsite md4c-html md4c) +target_include_directories(crowsite PRIVATE libs/md4c/src) target_compile_options(crowsite PRIVATE -Wall -Wextra -Wpedantic) if (${ENABLE_ADDRSAN} MATCHES ON) diff --git a/crow_test/webcontent/menu_bar.part b/crow_test/webcontent/menu_bar.part index 3ddddaf..f892e90 100644 --- a/crow_test/webcontent/menu_bar.part +++ b/crow_test/webcontent/menu_bar.part @@ -1,7 +1,7 @@