13 Commits
1.2.0 ... 1.3.0

Author SHA1 Message Date
Petra Baranski
1fe37d5a1f chore: fix other.yml 2023-08-26 13:34:41 +02:00
Petra Baranski
6e01add19a Merge pull request #49 from progsource/rc-1.3.0
Release 1.3.0
2023-08-26 13:33:19 +02:00
Petra Baranski
65730beffa chore: update version to 1.3.0 2023-08-26 13:28:28 +02:00
Petra Baranski
4722932068 docs: updated changelog 2023-08-26 13:25:11 +02:00
Petra Baranski
c4ca557e43 Merge pull request #48 from progsource/headline-inline-parsing
Headline inline parsing
2023-08-26 13:11:04 +02:00
Petra Baranski
650ea2bc82 ci: enable test runners for dev branch 2023-08-26 13:08:06 +02:00
Petra Baranski
ce81283b26 feat: enable optional inline parsing in headlines 2023-08-26 13:03:35 +02:00
Petra Baranski
211b627a75 chore: added 'other' issue template 2023-08-26 13:01:27 +02:00
Petra Baranski
7c6e32f4b1 Merge pull request #46 from progsource/version-1.2.1
chore: update version to 1.2.1
2023-08-06 13:35:51 +02:00
Petra Baranski
231785ff2d chore: update version to 1.2.1 2023-08-06 13:31:18 +02:00
Petra Baranski
09229aae0d Merge pull request #45 from Ivansstyle/fix_version_define
Refactored version() function in Parser class due to clashes with #define VERSION in various projects
2023-08-01 18:38:12 +02:00
Ivans Saponenko
4656252374 Edit branch due to Contribution Guidelines 2023-08-01 11:42:42 +03:00
Ivans Saponenko
9bcb7ce6dd Refactored version() function in Parser class due to clashes with defines 2023-08-01 11:19:31 +03:00
11 changed files with 99 additions and 11 deletions

View File

@@ -37,7 +37,9 @@ body:
label: maddy version label: maddy version
description: What version of maddy are you using? description: What version of maddy are you using?
options: options:
- 1.2.0 (latest) - 1.3.0 (latest)
- 1.2.1
- 1.2.0
- 1.1.2 - 1.1.2
- 1.1.1 - 1.1.1
- 1.1.0 - 1.1.0

View File

@@ -37,7 +37,9 @@ body:
label: maddy version label: maddy version
description: What version of maddy are you using? description: What version of maddy are you using?
options: options:
- 1.2.0 (latest) - 1.3.0 (latest)
- 1.2.1
- 1.2.0
- 1.1.2 - 1.1.2
- 1.1.1 - 1.1.1
- 1.1.0 - 1.1.0
@@ -51,7 +53,7 @@ body:
id: example id: example
attributes: attributes:
label: Minimal Mardown example label: Minimal Mardown example
description: To be able to reproduce your issue, please give some example Markdown which creates problems. description: To be able to reproduce your issue, please give some example Markdown which creates problems. Please indent the Markdown by 4 spaces.
validations: validations:
required: true required: true
- type: textarea - type: textarea

10
.github/ISSUE_TEMPLATE/other.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
name: Other
description: Anything that doesn't fit into one of the other issue categories
body:
- type: textarea
id: whats-up
attributes:
label: What is the issue?
description: Is some tooling not working? Performance issues? ...
validations:
required: true

View File

@@ -4,9 +4,11 @@ on:
push: push:
branches: branches:
- master - master
- dev
pull_request: pull_request:
branches: branches:
- master - master
- dev
jobs: jobs:
test-on-ubuntu: test-on-ubuntu:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@@ -10,3 +10,4 @@ Martin Kopecky (martin.kopecky357@gmail.com)
Andrew Mettlach (dmmettlach@gmail.com) Andrew Mettlach (dmmettlach@gmail.com)
Evan Klitzke (evan@eklitzke.org) Evan Klitzke (evan@eklitzke.org)
Albert Schwarzkopf (dev-maddy@quitesimple.org) Albert Schwarzkopf (dev-maddy@quitesimple.org)
Ivans Saponenko (ivans.saponenko+maddy@gmail.com)

View File

@@ -16,6 +16,14 @@ maddy uses [semver versioning](https://semver.org/).
* ? * ?
## version 1.3.0 2023-08-26
* ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) Headlines can have inline parsing now. It is on by default, but can be disabled by config.
## version 1.2.1 2023-08-06
* ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) Parser.h version() method clashing with VERSION defines at global scope
## version 1.2.0 2023-07-27 ## version 1.2.0 2023-07-27
* ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) Added Changelog * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) Added Changelog

View File

@@ -1,7 +1,7 @@
# maddy # maddy
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-brightgreen.svg)](https://semver.org/) [![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-brightgreen.svg)](https://semver.org/)
maddy is a C++ Markdown to HTML **header-only** parser library. maddy is a C++ Markdown to HTML **header-only** parser library.

View File

@@ -57,9 +57,11 @@ public:
*/ */
HeadlineParser( HeadlineParser(
std::function<void(std::string&)> parseLineCallback, std::function<void(std::string&)> parseLineCallback,
std::function<std::shared_ptr<BlockParser>(const std::string& line)> getBlockParserForLineCallback std::function<std::shared_ptr<BlockParser>(const std::string& line)> getBlockParserForLineCallback,
bool isInlineParserAllowed = true
) )
: BlockParser(parseLineCallback, getBlockParserForLineCallback) : BlockParser(parseLineCallback, getBlockParserForLineCallback)
, isInlineParserAllowed(isInlineParserAllowed)
{} {}
/** /**
@@ -103,7 +105,7 @@ protected:
bool bool
isLineParserAllowed() const override isLineParserAllowed() const override
{ {
return false; return this->isInlineParserAllowed;
} }
void void
@@ -131,6 +133,9 @@ protected:
line = std::regex_replace(line, hlRegex[i], hlReplacement[i]); line = std::regex_replace(line, hlRegex[i], hlReplacement[i]);
} }
} }
private:
bool isInlineParserAllowed;
}; // class HeadlineParser }; // class HeadlineParser
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@@ -57,7 +57,7 @@ public:
* Check https://github.com/progsource/maddy/blob/master/CHANGELOG.md * Check https://github.com/progsource/maddy/blob/master/CHANGELOG.md
* for the changelog. * for the changelog.
*/ */
static const std::string VERSION() { static const std::string v = "1.2.0"; return v; } static const std::string& version() { static const std::string v = "1.3.0"; return v; }
/** /**
* ctor * ctor
@@ -287,10 +287,22 @@ private:
maddy::HeadlineParser::IsStartingLine(line) maddy::HeadlineParser::IsStartingLine(line)
) )
{ {
parser = std::make_shared<maddy::HeadlineParser>( if (!this->config || this->config->isHeadlineInlineParsingEnabled)
nullptr, {
nullptr parser = std::make_shared<maddy::HeadlineParser>(
); [this](std::string& line){ this->runLineParser(line); },
nullptr,
true
);
}
else
{
parser = std::make_shared<maddy::HeadlineParser>(
nullptr,
nullptr,
false
);
}
} }
else if ( else if (
( (

View File

@@ -58,19 +58,34 @@ struct ParserConfig
{ {
/** /**
* @deprecated will be removed in 1.4.0 latest * @deprecated will be removed in 1.4.0 latest
*
* this flag = false == `enabledParsers &= ~maddy::types::EMPHASIZED_PARSER`
*/ */
bool isEmphasizedParserEnabled; bool isEmphasizedParserEnabled;
/** /**
* @deprecated will be removed in 1.4.0 latest * @deprecated will be removed in 1.4.0 latest
*
* this flag = false == `enabledParsers |= maddy::types::HTML_PARSER`
*/ */
bool isHTMLWrappedInParagraph; bool isHTMLWrappedInParagraph;
/**
* en-/disable headline inline-parsing
*
* default: enabled
*/
bool isHeadlineInlineParsingEnabled;
/**
* enabled parsers bitfield
*/
uint32_t enabledParsers; uint32_t enabledParsers;
ParserConfig() ParserConfig()
: isEmphasizedParserEnabled(true) : isEmphasizedParserEnabled(true)
, isHTMLWrappedInParagraph(true) , isHTMLWrappedInParagraph(true)
, isHeadlineInlineParsingEnabled(true)
, enabledParsers(maddy::types::DEFAULT) , enabledParsers(maddy::types::DEFAULT)
{} {}
}; // class ParserConfig }; // class ParserConfig

View File

@@ -64,3 +64,34 @@ TEST(MADDY_PARSER, ItShouldParseWithSmallConfig)
ASSERT_EQ(testHtml3, output); ASSERT_EQ(testHtml3, output);
} }
TEST(MADDY_PARSER, ItShouldParseInlineCodeInHeadlines)
{
const std::string headlineTest = R"(
# Some **test** markdown
)";
const std::string expectedHTML = "<h1>Some <strong>test</strong> markdown</h1>";
std::stringstream markdown(headlineTest);
auto parser = std::make_shared<maddy::Parser>();
const std::string output = parser->Parse(markdown);
ASSERT_EQ(expectedHTML, output);
}
TEST(MADDY_PARSER, ItShouldNotParseInlineCodeInHeadlineIfDisabled)
{
const std::string headlineTest = R"(
# Some **test** markdown
)";
const std::string expectedHTML = "<h1>Some **test** markdown</h1>";
std::stringstream markdown(headlineTest);
auto config = std::make_shared<maddy::ParserConfig>();
config->isHeadlineInlineParsingEnabled = false;
auto parser = std::make_shared<maddy::Parser>(config);
const std::string output = parser->Parse(markdown);
ASSERT_EQ(expectedHTML, output);
}