aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-29 18:19:29 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-29 18:19:29 -0700
commit022de93b3b270e0f8294d7c0912ebb3d2c05b9e7 (patch)
tree08042a3a691b6b7ce2ba13ea99acc2092fdee3ae
parent6e232a67dc1caa633865c16b7c02b81338e1246e (diff)
add blockquote processing
-rw-r--r--README.md4
-rw-r--r--include/markdown_translator.hpp1
-rw-r--r--src/markdown_translator.cpp14
-rw-r--r--styles/carbon.css6
4 files changed, 17 insertions, 8 deletions
diff --git a/README.md b/README.md
index 97590d4..dd79245 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
# Wiki-MD2HTML (WIP)
-A basic C++ parser that converts a specialized format of Markdown to a themed HTML style.
+A basic C++ parser that converts a specialized format of Markdown to a themed HTML style. Then apply some pre-defined CSS onto it.
-Designed for presenting information on-screen in a more "markdown-like" Wiki format
+Often times I want just a single page to display some markdown file. Some solutions for this are too overkill while others were too restrictive in terms of some of the features I wanted.
diff --git a/include/markdown_translator.hpp b/include/markdown_translator.hpp
index 4a62cbc..34efefb 100644
--- a/include/markdown_translator.hpp
+++ b/include/markdown_translator.hpp
@@ -110,6 +110,7 @@ private:
REGULAR,
IN_FIGURE,
IN_CODEBLOCK,
+ IN_BLOCKQUOTE
};
};
diff --git a/src/markdown_translator.cpp b/src/markdown_translator.cpp
index ee4c6ff..f906899 100644
--- a/src/markdown_translator.cpp
+++ b/src/markdown_translator.cpp
@@ -149,6 +149,20 @@ std::string MarkdownTranslator::translate(const std::string& markdownContent) {
continue;
}
+ if(line.find(">") == 0 && parseState != MarkdownTranslator::ParseState::IN_BLOCKQUOTE){
+ parseState = MarkdownTranslator::ParseState::IN_BLOCKQUOTE;
+ htmlOutput << " <blockquote>";
+ htmlOutput << " " << processLine(line.substr(1));
+ continue;
+ }
+ else if(parseState == MarkdownTranslator::ParseState::IN_BLOCKQUOTE && line.find(">") != 0 ){ // End of blockquote
+ parseState = MarkdownTranslator::ParseState::REGULAR;
+ htmlOutput << " </blockquote>";
+ }
+ else if(parseState == MarkdownTranslator::ParseState::IN_BLOCKQUOTE){
+ htmlOutput << " " << processLine(line.substr(1));
+ continue;
+ }
htmlOutput << " " << processLine(line);
}
diff --git a/styles/carbon.css b/styles/carbon.css
index 2cc3575..42e5743 100644
--- a/styles/carbon.css
+++ b/styles/carbon.css
@@ -286,22 +286,17 @@ blockquote {
background: linear-gradient(90deg, rgba(201, 170, 113, 0.1), transparent);
padding: 15px 20px;
margin: 1.5em 0;
- font-style: italic;
color: var(--text-secondary);
position: relative;
}
blockquote::before {
- content: '"';
font-size: 3em;
color: var(--accent-gold);
opacity: 0.3;
position: absolute;
- top: -10px;
- left: 10px;
}
-/* Tables with FFXIV UI styling */
table {
width: 100%;
border-collapse: separate;
@@ -603,7 +598,6 @@ img {
font-size: 1.3em;
}
}
-Blockquote
/* Animation for page load */
@keyframes fadeIn {
from {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage