diff --git a/src/MarkdownParser.cxx b/src/MarkdownParser.cxx index a531677..9abc2bc 100644 --- a/src/MarkdownParser.cxx +++ b/src/MarkdownParser.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 luca0N! + * Copyright (C) 2022-2023 luca0N! * * This file is part of Static Website Generator (swg). * @@ -102,9 +102,10 @@ std::string make_html(std::filesystem::path const &path) { // End ul tag if it's active and a new line doesn't contain an // item. - if (tag_ul && newline && buf[0] != '-') { + if (tag_ul && newline && buf[0] != '-' && buf[0] == '\n') { tag_ul = false; - html += ""; + tag_li = false; + html += ""; } // Read character by character @@ -129,15 +130,14 @@ std::string make_html(std::filesystem::path const &path) { html += ">"; tag_h = 0; } - if (tag_li) html += "", tag_li = false; - html += '\n'; + if (!tag_li) + html += '\n'; break; } // Start paragraph if newline and no // special characters were matched. - - if (!tag_comment && (!tag_p && newline && x == 0 && + if (!tag_comment && !tag_ul && (!tag_p && newline && x == 0 && c != '#' && c != '-')) html += "

", tag_p = true; @@ -261,6 +261,10 @@ std::string make_html(std::filesystem::path const &path) { // Start unordered list tag if it's not active. if (!tag_ul) html += "