mirror of
https://github.com/progsource/maddy.git
synced 2026-03-25 07:50:39 +01:00
d23ba23a4c986cbc6cabac86af116b303b0f7ca2
maddy
maddy is a C++ Markdown to HTML header-only parser library.
Supported OS
It actually should work on any OS, that supports the C++14 standard library.
It is tested to work on:
- Linux (gcc)
- OSX (clang)
- Windows (Visual Studio 17 2022, mingw)
Dependencies
- C++14
Why maddy?
When I was needing a Markdown parser in C++ I couldn't find any, that was fitting my needs. So I simply wrote my own one.
Markdown syntax
The supported syntax can be found in the definitions docs.
How to use
To use maddy in your project, simply add the include path of maddy to yours and in the code, you can then do the following:
#include <memory>
#include <string>
#include "maddy/parser.h"
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;
config->enabledParsers |= maddy::types::HTML_PARSER;
std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
std::string htmlOutput = parser->Parse(markdownInput);
You can find all parser flags in include/maddy/parserconfig.h.
How to run the tests
(tested on Linux with git and cmake installed)
Open your preferred terminal and type:
git clone https://github.com/progsource/maddy.git
cd maddy
mkdir tmp
cd tmp
cmake -DMADDY_BUILD_WITH_TESTS=ON ..
make
make test # or run the executable in ../build/MaddyTests
How to contribute
There are different possibilities:
- Create a GitHub issue
- Create a pull request with an own branch (don't forget to put yourself in the AUTHORS file)
Please also read CONTRIBUTING.md.
Languages
C++
85.5%
Python
9%
CMake
5.5%