diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | include/markdown_translator.hpp | 1 | ||||
| -rw-r--r-- | src/markdown_translator.cpp | 14 | ||||
| -rw-r--r-- | styles/carbon.css | 6 |
4 files changed, 17 insertions, 8 deletions
@@ -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 { |
