Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/cpp-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/markdown-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/create-release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF" >> $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)
6 changes: 4 additions & 2 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ 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
* ![**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

Expand Down
15 changes: 4 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -70,10 +70,8 @@ std::stringstream markdownInput("");

// config is optional
std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();
// 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<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
std::string htmlOutput = parser->Parse(markdownInput);
Expand Down
8 changes: 4 additions & 4 deletions docs/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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_
Expand Down
13 changes: 1 addition & 12 deletions include/maddy/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -72,17 +72,6 @@ class Parser
*/
Parser(std::shared_ptr<ParserConfig> 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)
{
Expand Down
18 changes: 1 addition & 17 deletions include/maddy/parserconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -85,9 +71,7 @@ struct ParserConfig
uint32_t enabledParsers;

ParserConfig()
: isEmphasizedParserEnabled(true)
, isHTMLWrappedInParagraph(true)
, isHeadlineInlineParsingEnabled(true)
: isHeadlineInlineParsingEnabled(true)
, enabledParsers(maddy::types::DEFAULT)
{}
}; // class ParserConfig
Expand Down
15 changes: 0 additions & 15 deletions tests/maddy/test_maddy_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,6 @@ TEST(MADDY_PARSER, ItShouldParse)
ASSERT_EQ(testHtml, output);
}

TEST(MADDY_PARSER, ItShouldParseWithConfig)
{
auto config = std::make_shared<maddy::ParserConfig>();
config->isEmphasizedParserEnabled = false;
config->isHTMLWrappedInParagraph = false;

auto parser = std::make_shared<maddy::Parser>(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<maddy::ParserConfig>();
Expand Down