diff --git a/.github/ISSUE_TEMPLATE/cpp-bug-report.yml b/.github/ISSUE_TEMPLATE/cpp-bug-report.yml index ab722be..a1c402f 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.4.0 (latest) + - 1.5.0 (latest) + - 1.4.0 - 1.3.0 - 1.2.1 - 1.2.0 diff --git a/.github/ISSUE_TEMPLATE/markdown-bug-report.yml b/.github/ISSUE_TEMPLATE/markdown-bug-report.yml index 12c8242..2ce857f 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.4.0 (latest) + - 1.5.0 (latest) + - 1.4.0 - 1.3.0 - 1.2.1 - 1.2.0 diff --git a/.github/workflows/create-release-package.yml b/.github/workflows/create-release-package.yml index c948c89..f445e07 100644 --- a/.github/workflows/create-release-package.yml +++ b/.github/workflows/create-release-package.yml @@ -40,9 +40,10 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/maddy-src.zip tag: ${{ github.ref }} + release_name: ${{ github.ref }} 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) + [full changelog](https://github.com/progsource/maddy/blob/master/CHANGELOG.md) diff --git a/.github/workflows/run-checks.yml b/.github/workflows/run-checks.yml index 9e744f4..7f65118 100644 --- a/.github/workflows/run-checks.yml +++ b/.github/workflows/run-checks.yml @@ -5,9 +5,6 @@ on: 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 d80d3f3..b118bec 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -5,9 +5,6 @@ on: branches: - master pull_request: - pull_request_target: - branches: - - master jobs: test-on-ubuntu: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f90e38..63c0fca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ maddy uses [semver versioning](https://semver.org/). ## Upcoming +* ... + +## version 1.5.0 2025-04-21 + * ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) Correctly parse links with title text, i.e. `[link](http://example.com "example")`. * ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) Do not create invalid URLs from links with spaces, i.e. `[link](/ABC/some file)`. * ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) Do not create invalid HTML from links with quotes, i.e. `[link](/ABC/some"file)`. diff --git a/LICENSE b/LICENSE index 4f4e581..1694b74 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2017, 2018, 2019, 2020, 2023 M. Petra Baranski +Copyright M. Petra Baranski (for contributors see AUTHORS file) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/README.md b/README.md index eb6a2c4..486c671 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.4.0](https://img.shields.io/badge/Version-1.4.0-brightgreen.svg)](https://semver.org/) +[![Version: 1.5.0](https://img.shields.io/badge/Version-1.5.0-brightgreen.svg)](https://semver.org/) maddy is a C++ Markdown to HTML **header-only** parser library. diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt index 5665411..d8fc0ec 100644 --- a/bench/CMakeLists.txt +++ b/bench/CMakeLists.txt @@ -35,6 +35,10 @@ file(GLOB_RECURSE MADDY_BENCHMARK_FILES # ------------------------------------------------------------------------------ +add_compile_definitions(CURRENT_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}") + +# ------------------------------------------------------------------------------ + add_executable( maddy_benchmark ${MADDY_BENCHMARK_FILES} diff --git a/bench/benchmark_test.md b/bench/benchmark_test.md new file mode 100644 index 0000000..e10807d --- /dev/null +++ b/bench/benchmark_test.md @@ -0,0 +1,416 @@ +# Benchmark test file + +This file is for the benchmark testing. + +--- + +This specification defines which markdown syntax can be parsed by maddy. +There is no HTML allowed in the markdown syntax - or said otherwise - it might +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->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 + +``` +# h1 heading +## h2 heading +### h3 heading +#### h4 heading +##### h5 heading +###### h6 heading +``` +results in: +```html +

h1 heading

+

h2 heading

+

h3 heading

+

h4 heading

+
h5 heading
+
h6 heading
+``` + +## Links + +``` +[Text of the link](http://example.com) +``` +results in +```html +Text of the link +``` + +``` +[Text of the link](http://example.com "title text") +``` +results in +```html +Text of the link +``` + +## Lists + +### unordered +Characters "*", "+" or "-" to make an unordered "bullet" list are equivalent. + +``` + +- unordered +* list ++ items + +``` +results in +```html + +``` + +``` + +* unordered + * list + * items + * in + + an + - hierarchy + +``` +results in +```html + +``` + +### ordered + +``` + +1. ordered +2. list +3. items + +``` + +results in + +```html + +
    +
  1. ordered
  2. +
  3. list
  4. +
  5. items
  6. +
+ +``` + +``` + +1. ordered +* list +* items + +``` + +results in + +```html + +
    +
  1. ordered
  2. +
  3. list
  4. +
  5. items
  6. +
+ +``` + +``` + +1. ordered +* list + 1. items + * in + 1. an + * hierarchy + +``` + +results in + +```html +
    +
  1. ordered
  2. +
  3. list +
      +
    1. items
    2. +
    3. in +
        +
      1. an
      2. +
      +
    4. +
    5. hierarchy
    6. +
    +
  4. +
+``` + +### combination + +``` + +* combination +* of + 1. unordered and + * ordered +* list + +``` +results in +```html + +``` + +### checklist + +``` + +- [ ] some item + - [ ] another item +- [x] some checked item + +``` +results in +```html + +``` +might not work in combination with other lists + +## Code Blocks + + ``` + some code + ``` + +results in +```html +

+some code
+
+``` + + ```cpp + int a = 42; + ``` + +results in + +```html +

+int a = 42;
+
+``` + +## Inline code + + some text `some inline code` some other text + +results in +```html +some text some inline code some other text +``` + +## quotes + +``` +> Some quote +``` +results in +```html + +

Some quote

+ +``` + +## bold + +``` +**bold text** +__bold text__ +``` +results in +```html +bold text +bold text +``` + +## italic + +``` +*italic text* +``` +results in +```html +italic text +``` + +## emphasized + +This can be disabled by setting `config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;`. + +``` +_emphasized text_ +``` +results in +```html +emphasized text +``` + +## strikethrough + +``` +~~striked through text~~ +``` +results in +```html +striked through text +``` + +## horizontal line + +``` +--- +``` +results in +```html +
+``` + +## break line + +``` +New\r\nLine +``` +results in +```html +New
+Line +``` + +## Images + +``` +![Image alt text](http://example.com/example.png) +``` +results in +```html +Image alt text +``` + +## Tables + +``` + +|table> +Left header | middle header | last header +- | - | - +cell 1 | cell 2 | cell 3 +cell 4 | cell 5 | cell 6 +- | - | - +foot a | foot b | foot c +| + + + + + + + + + + + + + + + + + + + + + + + + + + +
Left headermiddle headerlast header
cell 1cell 2cell 3
cell 4cell 5cell 6
foot afoot bfoot c
+``` +table header and footer are optional + +## LaTeX(MathJax) block support + +To turn on the LaTeX support - which basically is only a +[MathJax](https://www.mathjax.org/) support and makes sure, that formulas aren't +internally checked for other parsers - it has to be enabled in config: + +```cpp +std::shared_ptr config = std::make_shared(); +config->enabledParsers |= maddy::types::LATEX_BLOCK_PARSER; + +std::shared_ptr parser = std::make_shared(config); +std::string htmlOutput = parser->Parse(markdownInput); +``` + +After this you can do the following in Markdown: + +``` +$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$ +``` + +Which results in + +```html +$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$\n +``` diff --git a/bench/main.cpp b/bench/main.cpp index 56e9659..91349cc 100644 --- a/bench/main.cpp +++ b/bench/main.cpp @@ -15,7 +15,8 @@ int main() { - static const std::string markdownFile = "../docs/definitions.md"; + static const std::string markdownFile = + std::string(CURRENT_FILE_PATH) + "/benchmark_test.md"; std::stringstream buffer; { diff --git a/include/maddy/parser.h b/include/maddy/parser.h index fb2780d..e64fd81 100644 --- a/include/maddy/parser.h +++ b/include/maddy/parser.h @@ -59,7 +59,7 @@ public: */ static const std::string& version() { - static const std::string v = "1.4.0"; + static const std::string v = "1.5.0"; return v; }