diff --git a/src/MarkdownParser.cxx b/src/MarkdownParser.cxx index 1059e7f..3652078 100644 --- a/src/MarkdownParser.cxx +++ b/src/MarkdownParser.cxx @@ -40,6 +40,7 @@ std::string make_html(std::filesystem::path const &path) { // Tag flags bool tag_b = false, tag_i = false, + tag_p = false, // If there is an escape character at the end of the buffer, use // this flag to prevent ignoring it. escaping = false, @@ -52,6 +53,13 @@ std::string make_html(std::filesystem::path const &path) { int tag_h = 0; while (fgets(buf, buflen, mdFile) != NULL) { manualBreak = false; + + if (tag_p && buf[0] == '\n') { + // Empty newline; end paragraph. + html += "

\n"; + continue; + } + // Read character by character for (int x = 0; x < buflen; x++) { char c = buf[x]; @@ -72,6 +80,13 @@ std::string make_html(std::filesystem::path const &path) { html += '\n'; break; } + // Start paragraph if newline and no + // special characters were matched. + + if (newline && x == 0 && c != '#') + html += "

", + tag_p = true; + switch (c) { case '*': // Bold check