From 6fbf4db53700de42d7b3dc5c2f6cc20dcf1628c3 Mon Sep 17 00:00:00 2001 From: Simon Baynes Date: Tue, 6 Aug 2024 09:58:56 +0100 Subject: [PATCH 1/5] Migrate documentation generation action The current version of https://github.com/DenverCoder1/doxygen-github-pages-action only supports version doxygen version 1.9.1 which has a bug doxygen/doxygen#9317 where file scoped namespaces are not supported. I have forked the repo at https://github.com/baynezy/doxygen-github-pages-action and modified it to install any version I want. Closes #444 --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 0e5eca29..fb483d8d 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest environment: github-pages steps: - - uses: DenverCoder1/doxygen-github-pages-action@v1.3.0 + - uses: baynezy/doxygen-github-pages-action@feature/specific-version with: github_token: ${{ secrets.PUBLISH_DOCS_TOKEN }} branch: gh-pages From c29f73b0cff9085ac0146a0960c6b80497ee9b15 Mon Sep 17 00:00:00 2001 From: Simon Baynes Date: Tue, 6 Aug 2024 13:47:30 +0100 Subject: [PATCH 2/5] Modify docs publish action to match new signature Closes #446 --- .github/workflows/publish-docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index fb483d8d..9f458e61 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -16,4 +16,5 @@ jobs: with: github_token: ${{ secrets.PUBLISH_DOCS_TOKEN }} branch: gh-pages - config_file: doxygen.config \ No newline at end of file + config_file: doxygen.config + doxygen_version: 1.9.6 \ No newline at end of file From df5511664807b8efab1841914d64f197236396cd Mon Sep 17 00:00:00 2001 From: Simon Baynes Date: Wed, 7 Aug 2024 09:48:52 +0100 Subject: [PATCH 3/5] Fix bug with empty lists Closes #109 --- src/Html2Markdown/Replacement/HtmlParser.cs | 2 ++ ...WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt | 1 + ...WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt | 1 + test/Html2Markdown.Test/MarkdownSchemeConverterTest.cs | 9 +++++++++ 4 files changed, 13 insertions(+) create mode 100644 test/Html2Markdown.Test/CommonMarkSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt create mode 100644 test/Html2Markdown.Test/MarkdownSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt diff --git a/src/Html2Markdown/Replacement/HtmlParser.cs b/src/Html2Markdown/Replacement/HtmlParser.cs index cc051ef5..27b46b76 100644 --- a/src/Html2Markdown/Replacement/HtmlParser.cs +++ b/src/Html2Markdown/Replacement/HtmlParser.cs @@ -68,6 +68,8 @@ private static string ReplaceList(string html) } markdownList.Add($"{listPrefix}{finalList}"); }); + + if (markdownList.Count == 0) return string.Empty; //If a new line is already ending the markdown item, then we don't need to add another one return Environment.NewLine + Environment.NewLine + markdownList.Aggregate((current, item) => current.EndsWith(Environment.NewLine) ? current + item : current + Environment.NewLine + item) + Environment.NewLine + Environment.NewLine; diff --git a/test/Html2Markdown.Test/CommonMarkSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt b/test/Html2Markdown.Test/CommonMarkSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt new file mode 100644 index 00000000..c1b8d743 --- /dev/null +++ b/test/Html2Markdown.Test/CommonMarkSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt @@ -0,0 +1 @@ +emptyString \ No newline at end of file diff --git a/test/Html2Markdown.Test/MarkdownSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt b/test/Html2Markdown.Test/MarkdownSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt new file mode 100644 index 00000000..c1b8d743 --- /dev/null +++ b/test/Html2Markdown.Test/MarkdownSchemeConverterTest.Convert_WhenThereIsAnEmptyList_ThenRemoveTheList.verified.txt @@ -0,0 +1 @@ +emptyString \ No newline at end of file diff --git a/test/Html2Markdown.Test/MarkdownSchemeConverterTest.cs b/test/Html2Markdown.Test/MarkdownSchemeConverterTest.cs index 680c8328..741cf656 100644 --- a/test/Html2Markdown.Test/MarkdownSchemeConverterTest.cs +++ b/test/Html2Markdown.Test/MarkdownSchemeConverterTest.cs @@ -660,6 +660,15 @@ public Task Convert_WhenThereAreMultipleUnorderedLists_ThenReplaceWithMarkdownLi return CheckConversion(html); } + + // See issue https://github.com/baynezy/Html2Markdown/issues/109 + [Test] + public Task Convert_WhenThereIsAnEmptyList_ThenRemoveTheList() + { + const string html = "
"; + + return CheckConversion(html); + } #endregion From 994f429281b331fd27f2260b15b8b535a7f4b642 Mon Sep 17 00:00:00 2001 From: Simon Baynes Date: Wed, 7 Aug 2024 09:56:38 +0100 Subject: [PATCH 4/5] Add missing changelog message Closes #109 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 099fa86d..1471acd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed issue where empty HTML lists would cause a `System.InvalidOperationException` + ## [6.2.4.6] - 2024-08-02 ### Added From 278d32c484e1559ee6714b05fc8467c2d1d8b401 Mon Sep 17 00:00:00 2001 From: GitHub Action Bot Date: Wed, 7 Aug 2024 09:04:54 +0000 Subject: [PATCH 5/5] Prepare release 6.2.5.7 --- CHANGELOG.md | 5 ++++- semver.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1471acd0..b90a9039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [6.2.5.7] - 2024-08-07 + ### Fixed - Fixed issue where empty HTML lists would cause a `System.InvalidOperationException` @@ -474,7 +476,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.0.1] - 2013-07-04 -[unreleased]: https://github.com/baynezy/Html2Markdown/compare/6.2.4.6...HEAD +[unreleased]: https://github.com/baynezy/Html2Markdown/compare/6.2.5.7...HEAD +[6.2.5.7]: https://github.com/baynezy/Html2Markdown/compare/6.2.4.6...6.2.5.7 [6.2.4.6]: https://github.com/baynezy/Html2Markdown/compare/6.2.3.6...6.2.4.6 [6.2.3.6]: https://github.com/baynezy/Html2Markdown/compare/6.2.2.5...6.2.3.6 [6.2.2.5]: https://github.com/baynezy/Html2Markdown/compare/6.2.1.4...6.2.2.5 diff --git a/semver.json b/semver.json index 4b88c8fa..3bf8d8b5 100644 --- a/semver.json +++ b/semver.json @@ -1 +1 @@ -{"major":"6","minor":"2","patch":"4","build":"6"} \ No newline at end of file +{"major":"6","minor":"2","patch":"5","build":"7"} \ No newline at end of file