From 4015d088d90d199099ca41430d297c6cfd9d4ac6 Mon Sep 17 00:00:00 2001 From: Petra Baranski Date: Fri, 28 Mar 2025 04:09:17 +0100 Subject: [PATCH 1/3] up version to 1.4.0 --- .github/ISSUE_TEMPLATE/cpp-bug-report.yml | 3 ++- .github/ISSUE_TEMPLATE/markdown-bug-report.yml | 3 ++- .github/workflows/run-checks.yml | 6 ++++-- .github/workflows/run-tests.yml | 6 ++++-- CHANGELOG.md | 2 ++ CONTRIBUTING.md | 15 ++++----------- README.md | 2 +- include/maddy/parser.h | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/cpp-bug-report.yml b/.github/ISSUE_TEMPLATE/cpp-bug-report.yml index 5e1c797..ab722be 100644 --- a/.github/ISSUE_TEMPLATE/cpp-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/cpp-bug-report.yml @@ -37,7 +37,8 @@ body: label: maddy version description: What version of maddy are you using? options: - - 1.3.0 (latest) + - 1.4.0 (latest) + - 1.3.0 - 1.2.1 - 1.2.0 - 1.1.2 diff --git a/.github/ISSUE_TEMPLATE/markdown-bug-report.yml b/.github/ISSUE_TEMPLATE/markdown-bug-report.yml index 0da6e19..12c8242 100644 --- a/.github/ISSUE_TEMPLATE/markdown-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/markdown-bug-report.yml @@ -37,7 +37,8 @@ body: label: maddy version description: What version of maddy are you using? options: - - 1.3.0 (latest) + - 1.4.0 (latest) + - 1.3.0 - 1.2.1 - 1.2.0 - 1.1.2 diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml index b5749d6..9e744f4 100644 --- a/.github/workflows/run-checks.yml +++ b/.github/workflows/run-checks.yml @@ -1,11 +1,13 @@ name: run-checks - +run-name: run-checks ${{ github.ref }} on: push: branches: - master pull_request: - + pull_request_target: + branches: + - master jobs: run-clang-format: runs-on: ubuntu-24.04 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3b031aa..d80d3f3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,11 +1,13 @@ name: run-tests run-name: test ${{ github.ref }} on: - pull_request: push: branches: - master - - dev + pull_request: + pull_request_target: + branches: + - master jobs: test-on-ubuntu: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index e65dbfa..2d0cd36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ maddy uses [semver versioning](https://semver.org/). ## Upcoming +## version 1.4.0 2025-03-28 + * ![**CHANGED**](https://img.shields.io/badge/-CHANGED-%23e90) Updated google test to v1.16.0. * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) clang-format * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) automatic update dependencies ci diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 038b60f..7758e6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,17 +10,10 @@ improve the code? Then [create a GitHub issue](https://github.com/progsource/mad ## Creating Pull-Requests * Use a branch other than master. -* Add yourself to the `AUTHORS` file. -* Try to stick with the code style the files are having right now. -* Write in your commit messages what/why you did something. Often times a one-liner might be enough, but if you want to write more, make an empty line in between like: - ``` - Short description - - More and longer text for the commit message with some more information. - That can go over multiple lines. - ``` - Do not include Github issue ticket numbers inside commit messages. +* Feel free to add yourself to the `AUTHORS` file. (optional) +* Use clang-format to format the code. +* Write in your commit messages what/why you did something. Often times a one-liner might be enough. * Explain for what your PR is for - like providing a use-case or something similar. * Update documentation of the Markdown syntax if anything changed there. (`docs/definitions.md`) * Add a changelog entry at "Upcoming" inside of `CHANGELOG.md` -* Make sure, that the tests are successful. +* Make sure, that the tests are successful and if you wrote a bugfix, to have a test, that highlights the issue. diff --git a/README.md b/README.md index 62fb8ff..cfdcf5a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # maddy [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-brightgreen.svg)](https://semver.org/) +[![Version: 1.4.0](https://img.shields.io/badge/Version-1.4.0-brightgreen.svg)](https://semver.org/) maddy is a C++ Markdown to HTML **header-only** parser library. diff --git a/include/maddy/parser.h b/include/maddy/parser.h index 9f4a4cb..176a4c1 100644 --- a/include/maddy/parser.h +++ b/include/maddy/parser.h @@ -59,7 +59,7 @@ class Parser */ static const std::string& version() { - static const std::string v = "1.3.0"; + static const std::string v = "1.4.0"; return v; } From 9ddfd701de245351a21667bf9050658166b65754 Mon Sep 17 00:00:00 2001 From: Petra Baranski Date: Fri, 28 Mar 2025 04:23:35 +0100 Subject: [PATCH 2/3] Remove deprecated code --- CHANGELOG.md | 1 + README.md | 6 ++---- docs/definitions.md | 8 ++++---- include/maddy/parser.h | 11 ----------- include/maddy/parserconfig.h | 18 +----------------- tests/maddy/test_maddy_parser.cpp | 15 --------------- 6 files changed, 8 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d0cd36..9594374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ maddy uses [semver versioning](https://semver.org/). * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) clang-format * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) automatic update dependencies ci * ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) `(This is a [link](/ABC/some file) (the URL will include this).)` should not put the later parenthesis into the link url. +* ![**REMOVED**](https://img.shields.io/badge/-REMOVED-%23900) config flags `isEmphasizedParserEnabled` and `isHTMLWrappedInParagraph`. Use `config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;` and `config->enabledParsers |= maddy::types::HTML_PARSER;` to gain the same behavior as if the previous config flags were set to `false`. ## version 1.3.0 2023-08-26 diff --git a/README.md b/README.md index cfdcf5a..77a128b 100644 --- a/README.md +++ b/README.md @@ -70,10 +70,8 @@ std::stringstream markdownInput(""); // config is optional std::shared_ptr config = std::make_shared(); -// config->isEmphasizedParserEnabled = false; // default true - this flag is deprecated -// config->isHTMLWrappedInParagraph = false; // default true - this flag is deprecated -config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; // equivalent to !isEmphasizedParserEnabled -config->enabledParsers |= maddy::types::HTML_PARSER; // equivalent to !isHTMLWrappedInParagraph +config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; // disable emphasized parser +config->enabledParsers |= maddy::types::HTML_PARSER; // do not wrap HTML in paragraph std::shared_ptr parser = std::make_shared(config); std::string htmlOutput = parser->Parse(markdownInput); diff --git a/docs/definitions.md b/docs/definitions.md index 9be5075..a886ffb 100644 --- a/docs/definitions.md +++ b/docs/definitions.md @@ -7,9 +7,9 @@ destroy the output, if there was HTML in your markdown. The Parser expects you to use spaces and not tabs for indentation in the markdown. -If a line starts with `<` and `config->isHTMLWrappedInParagraph` is false, it -expects that the upcoming line is HTML and therefor will not be surrounded by a -paragraph. +If a line starts with `<` and `config->enabledParsers |= maddy::types::HTML_PARSER;` +is set, it expects that the upcoming line is HTML and therefor will not be +surrounded by a paragraph. ## Headlines @@ -279,7 +279,7 @@ results in ## emphasized -This can be disabled by setting `config->isEmphasizedParserEnabled = false`. +This can be disabled by setting `config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;`. ``` _emphasized text_ diff --git a/include/maddy/parser.h b/include/maddy/parser.h index 176a4c1..fb2780d 100644 --- a/include/maddy/parser.h +++ b/include/maddy/parser.h @@ -72,17 +72,6 @@ class Parser */ Parser(std::shared_ptr config = nullptr) : config(config) { - // deprecated backward compatibility - // will be removed in 1.4.0 latest including the booleans - if (this->config && !this->config->isEmphasizedParserEnabled) - { - this->config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; - } - if (this->config && !this->config->isHTMLWrappedInParagraph) - { - this->config->enabledParsers |= maddy::types::HTML_PARSER; - } - if (!this->config || (this->config->enabledParsers & maddy::types::BREAKLINE_PARSER) != 0) { diff --git a/include/maddy/parserconfig.h b/include/maddy/parserconfig.h index 04acdc7..f95ee04 100644 --- a/include/maddy/parserconfig.h +++ b/include/maddy/parserconfig.h @@ -58,20 +58,6 @@ enum PARSER_TYPE : uint32_t */ struct ParserConfig { - /** - * @deprecated will be removed in 1.4.0 latest - * - * this flag = false == `enabledParsers &= ~maddy::types::EMPHASIZED_PARSER` - */ - bool isEmphasizedParserEnabled; - - /** - * @deprecated will be removed in 1.4.0 latest - * - * this flag = false == `enabledParsers |= maddy::types::HTML_PARSER` - */ - bool isHTMLWrappedInParagraph; - /** * en-/disable headline inline-parsing * @@ -85,9 +71,7 @@ struct ParserConfig uint32_t enabledParsers; ParserConfig() - : isEmphasizedParserEnabled(true) - , isHTMLWrappedInParagraph(true) - , isHeadlineInlineParsingEnabled(true) + : isHeadlineInlineParsingEnabled(true) , enabledParsers(maddy::types::DEFAULT) {} }; // class ParserConfig diff --git a/tests/maddy/test_maddy_parser.cpp b/tests/maddy/test_maddy_parser.cpp index f6855fb..ed8530a 100644 --- a/tests/maddy/test_maddy_parser.cpp +++ b/tests/maddy/test_maddy_parser.cpp @@ -21,21 +21,6 @@ TEST(MADDY_PARSER, ItShouldParse) ASSERT_EQ(testHtml, output); } -TEST(MADDY_PARSER, ItShouldParseWithConfig) -{ - auto config = std::make_shared(); - config->isEmphasizedParserEnabled = false; - config->isHTMLWrappedInParagraph = false; - - auto parser = std::make_shared(config); - - std::stringstream markdown(testMarkdown); - - const std::string output = parser->Parse(markdown); - - ASSERT_EQ(testHtml2, output); -} - TEST(MADDY_PARSER, ItShouldParseWithBitwiseConfig) { auto config = std::make_shared(); From 5c5a983bb7f3a59fb40ef1ca1eb4c44c517fe53f Mon Sep 17 00:00:00 2001 From: Petra Baranski Date: Fri, 28 Mar 2025 04:57:38 +0100 Subject: [PATCH 3/3] change release message --- .github/workflows/create-release-package.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release-package.yml b/.github/workflows/create-release-package.yml index c5932fb..2192142 100644 --- a/.github/workflows/create-release-package.yml +++ b/.github/workflows/create-release-package.yml @@ -25,10 +25,24 @@ jobs: cmake -DMADDY_CREATE_PACKAGE=ON .. make maddy_package + - name: Get current tag message + id: tag-message + run: | + TAG_NAME=${GITHUB_REF#refs/tags/} + TAG_MESSAGE=$(git for-each-ref refs/tags/$TAG_NAME --format='%(contents)') + echo "message<> $GITHUB_OUTPUT + echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: create release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/maddy-src.zip tag: ${{ github.ref }} - body: "You can find all changes of this release in the [changelog](https://github.com/progsource/maddy/blob/master/CHANGELOG.md)" + body: | + ${{ steps.tag-message.outputs.message }} + + --- + + You can find all changes of this release in the [changelog](https://github.com/progsource/maddy/blob/master/CHANGELOG.md)