diff --git a/src/MarkdownParser.cxx b/src/MarkdownParser.cxx index 9c28c84..73ec370 100644 --- a/src/MarkdownParser.cxx +++ b/src/MarkdownParser.cxx @@ -42,6 +42,7 @@ std::string make_html(std::filesystem::path const &path) { tag_i = false, tag_p = false, tag_li = false, + tag_ul = false, // If there is an escape character at the end of the buffer, use // this flag to prevent ignoring it. escaping = false, @@ -62,6 +63,13 @@ std::string make_html(std::filesystem::path const &path) { continue; } + // End ul tag if it's active and a new line doesn't contain an + // item. + if (tag_ul && buf[0] != '-') { + tag_ul = false; + html += ""; + } + // Read character by character for (int x = 0; x < buflen; x++) { char c = buf[x]; @@ -83,6 +91,7 @@ std::string make_html(std::filesystem::path const &path) { html += '\n'; break; } + // Start paragraph if newline and no // special characters were matched. @@ -177,6 +186,8 @@ std::string make_html(std::filesystem::path const &path) { break; } + // Start unordered list tag if it's not active. + if (!tag_ul) html += "